DICE PACKS BUNDLE
  1. #1

    Getting windowclass from background image.

    I'm having some problems trying to find windowclass instances of background images. With the regular image window. Using the following function:

    Code:
    function Interface.findWindow( windowclass, datasource )

    Calling for example:

    Code:
    Interface.findWindow("imagewindow", imgParentContainer)
    Returns the windowclass instance. But after using the arrows at the top right image window to set the image as a background image, this returns a nil value.

    What is the windowclass name to call for finding the background image windowclass, as I'm assuming that is what's changing? Secondly where do I find the reference to that windoclass name in the xml of the CoreRPG.pak? Is there a new way to detect if the image is in background image mode?
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Try "imagepanelwindow"

    The definition is in CoreRPG campaign\record_image.xml
    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
    I'd be willing to bet the windowclass is not "imagewindow" for the background window/map. Add a override for Interface.onWindowOpened and get the windowclass name for every window opened and output, see what shows when you open up the background image (check the name).

    edit: Trenloe saved you the trouble
    Last edited by celestian; January 10th, 2019 at 22:17.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    Thanks guys, appreciate your help!

    Looks like I've been doing the right things in that case, but something is missing to make it work, it's like the window classes don't register in the scripts I'm working with after switching to background image mode.
    I had been working with 'campaign/record_image.xml' and scripts outside of that directory tree, for example 'scripts/manager_maptoken.lua'.

    So I'd tried a number of things before posting here, including trying to find the 'imagepanelwindow' instead of the 'imagewindow'. As 'imagewindow' is from what I can tell from reading the xml and how it appears the full dialog window, but 'imagepanelwindow' its first sub-window class that holds the content inside that window.

    Having placed a number of Debut.chat(...) outputs throughout that part of the code to track the variables. I can see that as soon as I zoom to background mode, neither 'imagewindow' nor 'imagepanelwindow' registers anymore using the Interface.findWindow call, returning nil values. Which causes the subsequent code to fail.
    Creating a new 'imagewindow' doesn't do anything when in background image mode, but creating a new 'imagepanelwindow' does create that actual section of the window on top of the actual background image, but in similar dimensions as a regular dialoged window. So not actually replacing the current background image, but placing another panel on top containing the same content, but without the dialog window options.

    I added a Interface.onWindowOpened override and output the results from the window parameter, which works and is a great way to find the window class and details. However it only runs when actually opening the image, which opens in regular dialog windowed mode. Tried toggling it from background image mode using the hotbar, but that only opens a new dialog windowed version underneath, so registers that window but not the background image one.

    Also tried adding a reference to for example the manager_maptoken.lua script within record_image.xml, within the <windowclass .. >. Similar to where you'd find calls to the 'updated_imagewindow.lua' in the Enhanced Images.ext above the <sheetdata>.
    In attempts to have the windowclasses be visible within the manager_maptoken.lua script, to see if that made a difference. Unfortunately it didn't behave differently afterwards, still giving nil reference errors.

    The only way I've found so far that registers the windowclass when in background mode is to open a new 'imagepanelwindow' window. But then I'm left with two image panels which isn't a solution in the end.

    2019-01-10.png
    Last edited by StoryWeaver; January 10th, 2019 at 22:41.
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



  5. #5

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Why can’t you just close the new panel after you grab the windowclass? Or can you open it invisible or change it to invisible after opening?

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    The key thing here is that the windowclasses are within a panel on the desktop, so they don't act the same as normal floating windows.

    Have a look at the global script ImageManager package scripts\manager_image.lua - I'm not exactly sure what you're trying to do, but some of the info in there might help understand what's going on.
    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!

  7. #7
    Quote Originally Posted by Trenloe View Post
    The key thing here is that the windowclasses are within a panel on the desktop, so they don't act the same as normal floating windows.

    Have a look at the global script ImageManager package scripts\manager_image.lua - I'm not exactly sure what you're trying to do, but some of the info in there might help understand what's going on.
    Using a helper function in ImageManager I've now managed to retrieve the window class from background image panels. I hadn't noticed the manager_image.lua file, as soon as I poked around it knowing it dealt with the images and panel versions it didn't take me long to find what I needed.

    Code:
    ImageManager.ImageControl(tokeninstance, bOpen)
    Returned the windowclass, so now I can plow ahead with the changes needed.

    Many thanks Trenloe and others!
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



  8. #8
    You'll need to use findWindow with the following calls to check every permutation:

    For the floating windows, you can get an exact image window by using:
    Interface.findWindow("imagewindow", path);

    For the background panels, you will need to look up the value of the subwindow within each background panel (if the subwindow exists).
    * Use "wBackPanel = Interface.findWindow("imagebackpanel", "")" and "wFullPanel = Interface.findWindow("imagefullpanel", "")" to get each top level panel window.
    * If the panel is not nil, then use "sClass, sRecord = wBackPanel.getValue()" to get the contained windows class and path information.
    * You don't need the class information, but then you can use the path information to see which image record value that the subwindow is pointing to.

    Regards,
    JPG

  9. #9
    Quote Originally Posted by Moon Wizard View Post
    You'll need to use findWindow with the following calls to check every permutation:

    For the floating windows, you can get an exact image window by using:
    Interface.findWindow("imagewindow", path);

    For the background panels, you will need to look up the value of the subwindow within each background panel (if the subwindow exists).
    * Use "wBackPanel = Interface.findWindow("imagebackpanel", "")" and "wFullPanel = Interface.findWindow("imagefullpanel", "")" to get each top level panel window.
    * If the panel is not nil, then use "sClass, sRecord = wBackPanel.getValue()" to get the contained windows class and path information.
    * You don't need the class information, but then you can use the path information to see which image record value that the subwindow is pointing to.

    Regards,
    JPG
    Thank you Moon Wizard, I've made those changes to another section of my code. It's all coming together now. : )
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



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
  •  
STAR TREK 2d20

Log in

Log in