Thursday, February 22, 2007

New UI Callback Parameters

In 1.06, callbacks can take 2 new 'variable' parameters in addition to global:# and local:#.

The first new parameter type is

This will insert the row # that is currently selected in the listbox indicated by listboxname

For example, if I had a callback that looked like:


On the same UIScene I have a listbox called 'mylb' where I have selected the 3rd row.

When the OnLeftClick callback above gets executed, the 1 parameter that gets sent to that script will be an integer with the value of 2. (The first row in the LB would send a value of 0).

The second new parameter type also deals with ListBoxes:

This will insert the text contained by that row. If the listbox rows are buttons or text fields, then the textfieldname parameter above is not necessary. If instead they are complex UI Panes, then the textfieldname will be used to specify which object within the pane contains the text we want.

For example, if I had a callback that looked like:

In the same UIScene, I have a Listbox named 'mylb'. The rows of that lb are complex UIPanes that contain a text field in them called 'mytext'.

When that callback executes, the engine will look at 'mylb', find the currently selected row, then look for the object named 'mytext' within that row and insert the text within that object as a parameter to the script on the server.

Now obviously the real power of these new variable parameters will be when coupled with the ability for scripts to populate a gui listbox. That functionality isn't in yet, but is something else I intend to have in for 1.06.

There are other new 'variable' parameter syntaxes that will be coming along with 1.06 that I'll post about once I have actually implemented them. :)


abraxas77 said...
This comment has been removed by the author.
abraxas77 said...

Rich, you just made my day! ... again.

Ahh, I taste the essence of model/view/controller. These new parameters may have me completely redesigning a lot of stuff, but I love it. Especially if you get the scripted listbox populating bits in there.


Grinning Fool said...

Hm, it just occurred to me; it seems there's still no way to insert information dynamically into a listbox? For some reason, I thought that this was included with all these changes, but I can't find any reference to it...