Jump to content

Welcome to Obsidian Forum Community
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!




Photo
- - - - -

New UI Callback Parameters

Posted by Rob McGinnis , 02 March 2007 · 5478 views

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

The first new parameter type is
listboxrow:listboxname

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:

OnLeftClick=UIObject_Misc_ExecuteServerScript("myguiscript",listboxrow:mylb)

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:
listboxtext:listboxname[.textfieldname]

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:
OnLeftClick=UIObject_Misc_ExecuteServerScript("myguiscript",listboxtext:mylb.mytext)

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. original.gif




Talking about the listboxrow:listboxName parameter.

Would it be possible to concatenate this value to obtain something like this:

OnLeftClick=UIObject_Misc_ExecuteServerScript("myguiscript",local:listboxrow:listboxName)?

As you can see I'm trying to retrieve a local variable index with the selected row number.
Am I wrong?
Any of this going to be carried any farther? Can we populate a listbox? Can we populate a grid? Can we pull the local variables off a selected grid or listbox?

I am getting tired of hardcoding lists of UI Buttons and UIText to fake listboxes, and frustrated figuring out how to populate a UIGrid cell.

These posts indicate some cool stuff that was planned for 1.06 that may or may not have made it in, and the documentation, which was wonderful, sort of trickled off and stopped. So close yet so far!
Hi There,

I tried the new listbox parameter (listboxtext:mylb.mytext).

Her is the snippet of my screen xml:
[codebox]<UIListBox name="MY_LISTBOX" x=26 y=139 width=272 height=251 yPadding=0 xPadding=0 showpartialchild=true
unequalcontrols=true scrollsegmentsize=30 hidescrollbarwhennotneeded=true >

<UIText name="TEST" text="This is a test" width=PARENT_WIDTH height=DYNAMIC align=left valign=top color="3d3131" fontfamily="NWN1_Dialog" style="bold" />

<UIButton name="SEND_DATA" text="Test" x=0 y=0 height=30 width=PARENT_WIDTH style="STYLE_SMALL_BUTTON"
OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX.TEST) >
</UIButton>

<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>
</UIListBox> [/codebox]


And this is the script:
[codebox]void main(string sDescription)
{
ActionSpeakString(sDescription);
} [/codebox]


I also tried the following syntax:
[codebox]UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX)[/codebox]


Whatever syntax I try, the script is not getting the content of the text object in the listbox.
Anything wrong?

Kind Regards
XiDragon
QUOTE(XiDragon @ Jul 15 2007, 02:36 PM)
Hi There,

I tried the new listbox parameter (listboxtext:mylb.mytext).

Her is the snippet of my screen xml:
[codebox]<UIListBox name="MY_LISTBOX" x=26 y=139 width=272 height=251 yPadding=0 xPadding=0 showpartialchild=true
unequalcontrols=true scrollsegmentsize=30 hidescrollbarwhennotneeded=true >

<UIText name="TEST" text="This is a test" width=PARENT_WIDTH height=DYNAMIC align=left valign=top color="3d3131" fontfamily="NWN1_Dialog" style="bold" />

<UIButton name="SEND_DATA" text="Test" x=0 y=0 height=30 width=PARENT_WIDTH style="STYLE_SMALL_BUTTON"
OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX.TEST) >
</UIButton>

<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>
</UIListBox> [/codebox]


And this is the script:
[codebox]void main(string sDescription)
{
ActionSpeakString(sDescription);
} [/codebox]


I also tried the following syntax:
[codebox]UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX)[/codebox]


Whatever syntax I try, the script is not getting the content of the text object in the listbox.
Anything wrong?

Kind Regards
XiDragon


Yes, you need to put the text element inside an UIPane element. original.gif
Thanks Caos81, but this does not fix the issue.
What you said is necessary to have objects like the button in the listbox not stretched, but it does not help with my problem.


@Rob McGinnis
I remember that I read somewhere on this website something from you like "Whatever questions you'll have, post them and I will try to help".

I would be glad if you would stand to your words and help me out. devil.gif


Have Fun
XiDragon
Photo
Rob McGinnis
Jul 20 2007 07:15 AM
QUOTE(XiDragon @ Jul 20 2007, 03:17 AM)
Thanks Caos81, but this does not fix the issue.
What you said is necessary to have objects like the button in the listbox not stretched, but it does not help with my problem.


@Rob McGinnis
I remember that I read somewhere on this website something from you like "Whatever questions you'll have, post them and I will try to help".

I would be glad if you would stand to your words and help me out. devil.gif


Have Fun
XiDragon


Well, as of right now, the listbox functions are incomplete. It is something we want to finish implementing, but it will not be before MoTB is released.
QUOTE(Rob McGinnis @ Jul 20 2007, 05:15 PM)
Well, as of right now, the listbox functions are incomplete. It is something we want to finish implementing, but it will not be before MoTB is released.


Hi Rob,

Thanks for letting me know.

I fiddled around for hours because I thought that I did something wrong. Therefore I would like to suggest to make it more clear in your News which functions are implemented and which not. It is not very motivating spending hours for nothing. I think that things like that can turn away modders and this is for sure not what you intend to do.

Have Fun
XiDragon


P.S. Because I am German and already made some bad experiences with Americans when it comes to criticism, seams that Germans and Americans handle this quite different, I want to assure you that I didn't mean to offend you with my criticism above. wink.gif
Photo
Rob McGinnis
Jul 21 2007 10:17 AM
QUOTE(XiDragon @ Jul 21 2007, 07:30 AM)
P.S. Because I am German and already made some bad experiences with Americans when it comes to criticism, seams that Germans and Americans handle this quite different, I want to assure you that I didn't mean to offend you with my criticism above. wink.gif


No worries. What I have seen is that non-native English speakers tend to be more to the point and, possibly, aren't aware of the nuances of some of the words in the language. Therefore their postings seem much more abrasive than intended. It would probably be much the same if I tried to do all my postings in German. The NWN2CR channel can tell you the horrors of that laughing.gif
I guess you are right.

I often realize that the most difficult things to translate are these regarding emotions or feelings, not at last because of the fine nuances. And because words about emotions and feelings do contain lots of explosiveness, especially in an environment like the internet where you communicate in only one dimension, one has to be very careful if he doesn't want to start flame wars.

Maybe I should put something in my signature like "BEWARE, I AM GERMAN". laughing.gif
Photo
brockfanning
Aug 14 2007 07:43 AM
I find that these parameters actually do work... as long as you put the "selectonleftclick=true" attribute on the UIListbox.

January 2019

S M T W T F S
  12345
6789101112
13141516171819
202122 23 242526
2728293031  

Recent Entries

Recent Comments