ScrollBar.st
changeset 5126 ad71b20ca516
parent 4916 8773e0c05f1b
child 5127 fcd696f9f401
--- a/ScrollBar.st	Sun Aug 03 14:31:33 2014 +0200
+++ b/ScrollBar.st	Sun Aug 03 14:31:57 2014 +0200
@@ -750,6 +750,14 @@
 createElements
     "private: create my elements"
 
+    (device supportsNativeWidgetType:#Scrollbar) ifTrue:[
+        "/ native widget contains all I need.
+        "/ but I need a thumb fro the model
+        thumb := Scroller new.
+        thumb beInvisible.
+        ^ self
+    ].
+
     orientation == #horizontal ifTrue:[
         button1 := ArrowButton leftIn:self.
         button1 name:'leftButton'.
@@ -809,6 +817,11 @@
         thumb addDependent:self
     ].
 
+    button1 isNil ifTrue:[
+        "/ native widget: no buttons
+        ^ self
+    ].
+
     button1 autoRepeat:true.
     button2 autoRepeat:true.
 
@@ -968,22 +981,24 @@
 !
 
 updateNativeWidget
+    |id|
+
     self isNativeWidget ifTrue:[
-        self drawableId notNil ifTrue:[
+        (id := self drawableId) notNil ifTrue:[
             self graphicsDevice
                 setScrollRange:0 to:100 
                 redraw:false 
-                in:self drawableId.
+                in:id.
 
             self graphicsDevice
                 setScrollPosition:thumb thumbOrigin rounded 
                 redraw:false 
-                in:self drawableId.
+                in:id.
 
             self graphicsDevice
                 setScrollBarPageSize:thumb thumbHeight rounded 
                 redraw:true 
-                in:self drawableId.
+                in:id.
         ]
     ].
 ! !
@@ -1179,10 +1194,10 @@
 !ScrollBar class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.92 2014-02-18 16:47:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.93 2014-08-03 12:31:57 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.92 2014-02-18 16:47:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollBar.st,v 1.93 2014-08-03 12:31:57 cg Exp $'
 ! !