very basic listbox code request for comments
Brian T. Rice
water at tunes.org
Sun Apr 23 10:14:46 PDT 2006
I don't have a lot of time to process this one, but I'll note that
#addSlotAndReturnValue:valued: is now a redundant utility, and that the
#addSlot: etc. variants including #define: now all return the value placed
in the slot. I should have refactored the existing UI demo code to reflect
that already.
The next steps are, of course, appropriate. :)
Otherwise it looks like a decent start. Feel free to experiment with
idioms for new nouns and verbs until the code feels more natural.
On Sat, April 22, 2006 1:36 pm, Timmy Douglas said:
>
> 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:
>
>
> diff file:
>
> 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'.
>
>
--
http://tunes.org/~water/brice.vcf
More information about the Slate
mailing list