very basic listbox code request for comments
Timmy Douglas
timmy+slate at cc.gatech.edu
Sat Apr 22 13:36:05 PDT 2006
This is my first time writing more than 10 lines of slate code so I'd
like to get some comments. I guess from here I would:
1. add selection color or attributes (along the same lines as you add
properties by changing the parents)
2. add a scrollpane object somewhere else and use it (i guess all
these types of things will be used by adding them to parents:?)
3. select the right item when clicking on the listbox area
4. only repaint visible objects
~/src/slate/slate/main/src/ui/listbox.slate:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listbox.slate
Type: application/octet-stream
Size: 2153 bytes
Desc: not available
Url : /archives/slate/attachments/20060422/ee135b28/listbox.obj
-------------- next part --------------
diff file:
-------------- next part --------------
diff -rN -u old-main/demo/ui.slate new-main/demo/ui.slate
--- old-main/demo/ui.slate 2006-04-22 16:21:41.854888432 -0400
+++ new-main/demo/ui.slate 2006-04-22 16:21:42.494791152 -0400
@@ -35,6 +35,18 @@
v
].
+
+
+lobby addSlot: #numberList valued: (ListboxElement newTarget: Nil getList: #getList getSelection: #getSelection setSelection: #setSelection:).
+
+lobby addSlot: #numberListSelected valued: 0.
+
+lb at numberList getList [ {1. 2. 3. 4. 5. 6. 7} ].
+lb at numberList getSelection [ lobby numberListSelected ].
+lb at numberList setSelection: value@(Integer traits) [ lobby numberListSelected: value ].
+
+
+
(lobby addSlotAndReturnValue: #mainWindow valued: (WindowSceneElement newWidth: 640 height: 480)) `>> [
parents: {
WindowSceneElement.
@@ -47,6 +59,14 @@
bold: True.
textColor: Colors Red.
addAll: {
+ numberList `>> [
+ parents: childParents.
+ position: (400, 50).
+ extent: (200, 200).
+ backgroundColor: Colors Grey.
+ text: '#numberList'.
+ bold: True.
+ ].
(addSlotAndReturnValue: #container1 valued: SceneElement new) `>> [
parents: containerParents ; {HBox}.
position: (50, 50).
diff -rN -u old-main/src/ui/README new-main/src/ui/README
--- old-main/src/ui/README 2006-04-22 16:21:41.658918224 -0400
+++ new-main/src/ui/README 2006-04-22 16:21:42.315818360 -0400
@@ -100,8 +100,9 @@
load: 'src/ui/frame.slate'.
load: 'src/ui/inspector.slate'.
load: 'src/ui/contextsceneelement.slate'.
+load: 'src/ui/listbox.slate'.
-You probably want to save your image at this point.
+"You probably want to save your image at this point."
load: 'src/plugins/sdl-windows/windows.slate'.
load: 'src/plugins/cairo/cairo.slate'.
More information about the Slate
mailing list