PDA

View Full Version : Calling a parent's button control state from a windowlist instance



Tabulazero
June 12th, 2019, 23:23
Hi there,

I have a windowclass named "feat_holder" which contains a windowlist called "list" and a buttoncontrol called "button_edit"

as part of the windowlist I have a class called ""feat_holder_list" which contains a buttoncontrol called "button_delete"

Is there a way for button_delete to querry the state of button_edit ?

window.button_edit.getvalue(); does not seem to work. When I type self.getvName() it returns button_delete.

I guess I could always use the DB but I am wondering if there is a more direct way for a list item in a windowlist to querry the status of a control situated in its parent window ?

Any help would be appreciated

Moon Wizard
June 13th, 2019, 00:38
This might be a good page for you to browse through:
https://www.fantasygrounds.com/wiki/index.php/Developer_Guide_-_Rulesets_-_Scripting

When calling upwards, you can use:
* "window" = (For windowcontrol) Windowinstance object which contains this control
* "parentcontrol" = (For windowinstance) Subwindow control containing window (will be nil if not within subwindow)
* "windowlist" = (For windowinstance) Windowlist control containing window (will be nil if not within windowlist)

When calling downwards, you can use:
* (For windowinstance) Use name of control to access window control instance (controls must be named to access this way)
* "subwindow" = (For subwindow control) Windowinstance contained within control (will be nil if not instantiated yet)
* (For windowlist control) Use getWindows() API to return Lua table of window objects, and iterate through list.

Based on what you stated above, you would query window.windowlist.window.button_edit.getValue()

Regards,
JPG