STAR TREK 2d20
  1. #1
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253

    Subwindow to Subwindow

    Starting from a subwindow, I need to get access to a control in another subwindow.
    If I'm not wrong, there was an utility function already prepared to do this job, but I can't find it.
    Who can help me?
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,413
    According to the developer guide for the subwindow control, "a reference to the parent subwindow control is available from the contained windowinstance object through the parentcontrol variable." https://fantasygroundsunity.atlassia...5196/subwindow

    Not knowing your exact GUI control hierarchy, you could try something like parentcontrol.window.{name of other subwindow}.subwindow to access another subwindow from within a different subwindow. If this doesn't work, you can usually work out the path needed by use of Debug statements for parentcontrol.window and other variations on that GUI path.
    Last edited by Trenloe; November 11th, 2023 at 11:34.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,413
    Quote Originally Posted by Xarxus View Post
    If I'm not wrong, there was an utility function already prepared to do this job, but I can't find it.
    Search for parentcontrol in the CoreRPG manager_utility.lua file for some functions related to this. getTopWindow(w) returns the top window, if w is a subwindow then it just uses parentcontrol.window to get to the top level window.
    Last edited by Trenloe; November 11th, 2023 at 11:15.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  4. #4
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253
    Yep, I was using this --> parentcontrol.window.{name of other subwindow}.subwindow, but when I try to reach a control inside it seems to not work.
    I think I should get to the windowinstance first, is that right?

    getTopWindow(w) is the same, it gives the subwindow.

    I tried this

    Code:
     _wMyWindow = parentcontrol.window["myWindow"].subwindow;
    
    Debug.console(_wMyWindow);                  -- The output is --> subwindow = { name = "myWindow", x,y,w,h = 30,45,600,635 }
    
    _wMyWindow["myControlName"].getValue();     -- It doesn't work
    _wMyWindow.myControlName.getValue();        -- It doesn't work
    What I'm doing wrong?
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,413
    Write debug for the controls you're trying to access. Output _wMyWindow.myControlName to debug, for example.

    Also, ensure that the subwindow and its contents has been fully created when you're trying to access it via code. You may need to specify <activate /> in the subwindow definition: https://fantasygroundsunity.atlassia...5196/subwindow
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  6. #6
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253
    Gotcha! Solved --> fastinit is the way

    Ty Trenloe
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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