DICE PACKS BUNDLE
  1. #1

    Checking the state of a button outside a windowlist

    I previously asked a question about getting a value in the header subwindow when in the content subwindow. I had to do something like:
    local sName = window.parentcontrol.window.header.subwindow.name. getValue();

    Now I am on the charsheet and I have a page called Combat. On the page I have a buttoncontrol with 2 states, a number field, and a windowlist.

    The window list is using a windowclass called detail. In there I have a button and I am just trying to pull the values from the buttoncontrol and the number.

    The number is super easy:
    local winChar = window.getDatabaseNode().getParent().getParent();
    local Val = winChar.getChild("num_test").getValue();
    Debug.chat("Val: ",Val);

    But I can't pull the state of the button the same way. On the Combat Tracker I just registered the window to a lua file and then used that to get the value. But that only works when there is only 1 window you will open. If I open a second character sheet it registers that character to the control and obviously that will not work.

    I made sure that I can getValue() the button if I am on the same page using window.btn_test.getValue();

    How do I get out of the detail, out of the windowlist, on to the page so I can call btn_test?

  2. #2
    Is the button a buttonfield that stores it's information in the database; or a buttoncontrol that is just temporary information?

    For a buttonfield, you should be able to pull out of the database.
    For a buttoncontrol, you'd have to navigate up and back down. For subwindows, navigate up from a windowinstance using "parentcontrol". For window lists, navigate up from a windowinstance using "windowlist".

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    Is the button a buttonfield that stores it's information in the database; or a buttoncontrol that is just temporary information?

    For a buttonfield, you should be able to pull out of the database.
    For a buttoncontrol, you'd have to navigate up and back down. For subwindows, navigate up from a windowinstance using "parentcontrol". For window lists, navigate up from a windowinstance using "windowlist".

    Regards,
    JPG
    It is a buttoncontrol, I guess I need to familiarize myself with buttonfield. That would probably be the easier of the two routes.

    Can you give an example of how I would use windowlist to traverse from the detail, to the windowlist to the charsheet?

    Would it be something like windowlist.parentcontrol.window.btn_test ?
    I didn’t see any examples (also didn’t know what I was looking for) in Core and a few other rulesets.

  4. #4
    It all depends on the structure of your window classes and controls.

    For a control;
    * Upstream: Use "window".
    * Downstream: (Only for subwindows and windowlists) Use "subwindow" for subwindow controls which points to a window instance; and "getWindows()" function for windowlist controls which returns a table of window instances.

    For a windowinstance:
    * Upstream: (Only for embedded windows) For windows embedded in subwindow controls, use "parentcontrol". For windows embedded in windowlist controls, use "windowlist".
    * Downstream: Use the name attribute of the control to access that control within a windowinstance script. (If no name attribute defined, then control will not be accessible.)

    Regards,
    JPG

  5. #5
    Thank you, this helped A Lot.

    Also, it is just much easier to make it a button field. But at least I know how to traverse windows a little better now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in