Jump to content
  • entries
    74
  • comments
    426
  • views
    1446544

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

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. :)

10 Comments


Recommended Comments

Caos81

Posted

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?

Pacis

Posted

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!

XiDragon

Posted

Hi There,

 

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

 

Her is the snippet of my screen xml:

<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>	

 

 

And this is the script:

void main(string sDescription)
{
ActionSpeakString(sDescription);
}	

 

 

I also tried the following syntax:

UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX)

 

 

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

Anything wrong?

 

Kind Regards

XiDragon

Caos81

Posted

Hi There,

 

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

 

Her is the snippet of my screen xml:

<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>	

 

 

And this is the script:

void main(string sDescription)
{
ActionSpeakString(sDescription);
}	

 

 

I also tried the following syntax:

UIObject_Misc_ExecuteServerScript("gui_xui_examine",listboxtext:MY_LISTBOX)

 

 

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. :)

XiDragon

Posted

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:

 

 

Have Fun

XiDragon

Rob McGinnis

Posted

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:

 

 

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.

 

XiDragon

Posted

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. ;)

Rob McGinnis

Posted

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. ;)

 

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 :lol:

XiDragon

Posted

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". :lol:

brockfanning

Posted

I find that these parameters actually do work... as long as you put the "selectonleftclick=true" attribute on the UIListbox.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...