5E Product Walkthrough Playlist
  1. #1
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    Location
    Goldstone, CA, USA
    Posts
    1,211
    Blog Entries
    29

    How does one programmatically resize a window?

    I'm working with masterindex in campaign_masterindex.xml.

    As I had guessed, the number of custom filters for the NPC library editor is large. When the NPC editor opens for the first time the controls overlap each other. It would be amusing if it wasn't so ugly.

    The window is spawned in the toggleIndex() function in the DesktopManager. If I put setSize() and setPosition() function calls in toggleIndex() I can easily resize the window to my desired height. But I'd prefer to place those functions within the script of masterindex (in masterindex_window.lua) because that is where all of my other code is already.

    I have tried placing the setSize() and setPosition() function calls in the onInit() of masterindex_window.lua of my extension, in the onInit() of masterindex_window.lua of the ruleset, and I've tried calling those functions in the ruleset using super.setSize() from my extension. All without success. No errors are thrown. The window just doesn't refresh to the new size.

    As a last resort I tried getting a handle on the window using the Interface.findwindow() function from the onInit() but that didn't work either.

    Any other hints would be greatly appreciated. Thanks in advance.
    Current Projects:
    Always...
    Community Contributions:
    Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
    Tutorial Blog Series: "A Neophyte Tackles (coding) the FG Extension".

  2. #2

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    I believe setSize and setPosition only change the controls/windows in memory and not their source definitions in the code file. Therefore, no onInit call in an extension is going to have an effect. Similarly, any onInit of any control/window script file is going to get called before the control is created. You have two choices. You can either defer control creation through use of the fastinit tag or by some other technique I cannot remember. Search for fastinit, and you will find at least one discussion of what you are trying to do. The problem is that controls are instantiated before the window containing them is fully initialized.

  3. #3
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    Location
    Goldstone, CA, USA
    Posts
    1,211
    Blog Entries
    29
    Thanks Bidmaron. It appears as though it isn't as simple as I had hoped. I'll have to proceed with the solution that works, at the time the window is instantiated.

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
  •  
5E Character Create Playlist

Log in

Log in