Jump to content
  • entries
    74
  • comments
    426
  • views
    1,414,441

New UI Callback Parameters

Sign in to follow this  
Rob McGinnis

5,778 views

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

Sign in to follow this  


10 Comments


Recommended Comments

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?

Share this comment


Link to comment

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!

Share this comment


Link to comment

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

Share this comment


Link to comment
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. :)

Share this comment


Link to comment

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

Share this comment


Link to comment
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.

 

Share this comment


Link to comment
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. ;)

Share this comment


Link to comment
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:

Share this comment


Link to comment

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:

Share this comment


Link to comment

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

Share this comment


Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...