Trouble getting slate gui started from instructions

Timmy Douglas timmy+slate at cc.gatech.edu
Tue Apr 11 13:25:36 PDT 2006


Well it's almost working, but I've ran into one thing I'm not too sure
about. ui.slate makes ScreenElements. Derived from that is Text, where
the 'text:' message is defined. Since ui.slate tries to call 'text:'
on ScreenElement instances, it fails.

That's not the whole story though, the instances of ScreenElement try
to dynamically change their parents through the traits window (see
graphics.slate:63 for the function I'm tring to understand as I write
this). However, even though Text is listed in the new parents, it
still doesn't work. I guess I'll have to get to understand this
delegation stuff some more.

The main question I can see about this patch is whether
#mouseButtonBlah or #MouseButtonBlah is better. Since the symbol is
the name of a class also, I made all the symbols capitalized. If I
changed the ScreenElements that call text: in ui.slate to Text
objects, then it seems to run without problems.


-------------- next part --------------
diff -rN -u old-main/demo/ui.slate new-main/demo/ui.slate
--- old-main/demo/ui.slate	2006-04-11 16:23:04.457274912 -0400
+++ new-main/demo/ui.slate	2006-04-11 16:23:05.278150120 -0400
@@ -1,18 +1,18 @@
 "Demonstration of Windows + Cairo + SceneElement"
 
-define: #BecomeStar &parents: {SceneElement}.
+lobby define: #BecomeStar &parents: {SceneElement}.
 se@(BecomeStar traits) handle: event@(RightMouseButtonPressEvent traits)
 [
     se parents: starParents.
 ].
 
-define: #BecomeRect &parents: {SceneElement}.
+lobby define: #BecomeRect &parents: {SceneElement}.
 se@(BecomeRect traits) handle: event@(RightMouseButtonPressEvent traits)
 [
     se parents: rectParents.
 ].
 
-addSlot: #containerParents valued: {
+lobby addSlot: #containerParents valued: {
     PaintSolidBackground. 
     PaintChildren. 
     PaintHandles. 
@@ -22,12 +22,12 @@
     PassPointerToChildren.
     Drag}.
 
-addSlot: #childParents valued: {
+lobby addSlot: #childParents valued: {
     PaintSolidBackground. 
     Text}.
 
-addSlot: #rectParents valued: childParents ; {BecomeStar}.
-addSlot: #starParents valued: childParents ; {Star. BecomeRect}.
+lobby addSlot: #rectParents valued: childParents ; {BecomeStar}.
+lobby addSlot: #starParents valued: childParents ; {Star. BecomeRect}.
 
 r@(Root traits) addSlotAndReturnValue: s valued: v
 [
diff -rN -u old-main/src/plugins/sdl-windows/windows.slate new-main/src/plugins/sdl-windows/windows.slate
--- old-main/src/plugins/sdl-windows/windows.slate	2006-04-11 16:23:04.413281600 -0400
+++ new-main/src/plugins/sdl-windows/windows.slate	2006-04-11 16:23:05.210160456 -0400
@@ -38,51 +38,60 @@
   event addSlot: #osWindow valued: Windows Lib primitives getEventWindow do.
 ].
 
-event@(Event traits) construct: _@#mouseButtonPosition
+event@(Event traits) construct: _@#MouseButtonPosition
 [
   event position:
     Windows Lib primitives getEventMouseButtonX do ,
     Windows Lib primitives getEventMouseButtonY do.
 ].
 
-event@(Event traits) construct: _@#mouseMotionPosition
+event@(Event traits) construct: _@#MouseMotionPosition
 [
   event position:
     Windows Lib primitives getEventMouseMotionX do ,
     Windows Lib primitives getEventMouseMotionY do.
 ].
 
+
+event@(Event traits) construct: _@#MouseMotionEvent
+[
+  event position:
+    Windows Lib primitives getEventMouseMotionX do ,
+    Windows Lib primitives getEventMouseMotionY do.
+].
+
+
 Windows addSlot: #eventTable valued: Dictionary new.
 
 {
-    100 -> #(LeftMouseButtonPressEvent          (osWindow mouseButtonPosition)).
-    101 -> #(LeftMouseButtonReleaseEvent        (osWindow mouseButtonPosition)).
-    102 -> #(LeftMouseButtonDoubleClickEvent    (osWindow mouseButtonPosition)).
-
-    110 -> #(RightMouseButtonPressEvent         (osWindow mouseButtonPosition)).
-    111 -> #(RightMouseButtonReleaseEvent       (osWindow mouseButtonPosition)).
-    112 -> #(RightMouseButtonDoubleClickEvent   (osWindow mouseButtonPosition)).
-
-    120 -> #(MiddleMouseButtonPressEvent        (osWindow mouseButtonPosition)).
-    121 -> #(MiddleMouseButtonReleaseEvent      (osWindow mouseButtonPosition)).
-    122 -> #(MiddleMouseButtonDoubleClickEvent  (osWindow mouseButtonPosition)).
-
-    130 -> #(X1MouseButtonPressEvent            (osWindow mouseButtonPosition)).
-    131 -> #(X1MouseButtonReleaseEvent          (osWindow mouseButtonPosition)).
-    132 -> #(X1MouseButtonDoubleClickEvent      (osWindow mouseButtonPosition)).
-
-    140 -> #(X2MouseButtonPressEvent            (osWindow mouseButtonPosition)).
-    141 -> #(X2MouseButtonReleaseEvent          (osWindow mouseButtonPosition)).
-    142 -> #(X2MouseButtonDoubleClickEvent      (osWindow mouseButtonPosition)).
-
-    150 -> #(MouseMotionEvent                   (osWindow mouseMotionPosition)).
-    151 -> #(MouseEnterEvent                    (osWindow mouseMotionPosition)).
-    152 -> #(MouseLeaveEvent                    (osWindow mouseMotionPosition)).
+    100 -> #(LeftMouseButtonPressEvent          (osWindow MouseButtonPosition)).
+    101 -> #(LeftMouseButtonReleaseEvent        (osWindow MouseButtonPosition)).
+    102 -> #(LeftMouseButtonDoubleClickEvent    (osWindow MouseButtonPosition)).
+
+    110 -> #(RightMouseButtonPressEvent         (osWindow MouseButtonPosition)).
+    111 -> #(RightMouseButtonReleaseEvent       (osWindow MouseButtonPosition)).
+    112 -> #(RightMouseButtonDoubleClickEvent   (osWindow MouseButtonPosition)).
+
+    120 -> #(MiddleMouseButtonPressEvent        (osWindow MouseButtonPosition)).
+    121 -> #(MiddleMouseButtonReleaseEvent      (osWindow MouseButtonPosition)).
+    122 -> #(MiddleMouseButtonDoubleClickEvent  (osWindow MouseButtonPosition)).
+
+    130 -> #(X1MouseButtonPressEvent            (osWindow MouseButtonPosition)).
+    131 -> #(X1MouseButtonReleaseEvent          (osWindow MouseButtonPosition)).
+    132 -> #(X1MouseButtonDoubleClickEvent      (osWindow MouseButtonPosition)).
+
+    140 -> #(X2MouseButtonPressEvent            (osWindow MouseButtonPosition)).
+    141 -> #(X2MouseButtonReleaseEvent          (osWindow MouseButtonPosition)).
+    142 -> #(X2MouseButtonDoubleClickEvent      (osWindow MouseButtonPosition)).
+
+    150 -> #(MouseMotionEvent                   (osWindow MouseMotionPosition)).
+    151 -> #(MouseEnterEvent                    (osWindow MouseMotionPosition)).
+    152 -> #(MouseLeaveEvent                    (osWindow MouseMotionPosition)).
 } do: [|:each|
     Windows eventTable at: each key put:
       (Windows EventTableEntry
          newPrototype: (events atSlotNamed: each value first)
-         constructors: each value first)].
+         constructors: each value second)].
 
 w at Windows constructEvent
 [



More information about the Slate mailing list