View Full Version : Map window on top precedence when processing double click
SilentRuin
February 8th, 2021, 16:36
I'm trying to understand why when I bring up a window (map in my case) with a calls like this...
...
local w = Interface.openWindow("imagewindow", lastsRecord);
if w then
...
w.image.setViewpointCenter(x,y,zoom);
end
...
it will bring up the window on TOP of my combat tracker (desired behavior) when triggering from a double click on a XML stringcontrol, but when triggering from a double click on a XML tokenfield it will not bring it to TOP.
Only difference is where I'm calling the logic from in the XML, which are both in the same windowclass. Why is this happening? Is there a way to make them behave the same?
Moon Wizard
February 8th, 2021, 17:47
I'm not sure. Might be different ordering of operations in each field type.
Can you provide a simple extension that does this in CoreRPG; and I can take a look.
Regards,
JPG
SilentRuin
February 8th, 2021, 18:50
I'm not sure. Might be different ordering of operations in each field type.
Can you provide a simple extension that does this in CoreRPG; and I can take a look.
Regards,
JPG
Complex. The stringfield has to go into the DB and have at least one token in an image in your campaign that it can grab onto and apply the above calls - while the tokenfield would have to a token it could grab onto to jump into an image it was placed in to bring up the image and zoom into it. I'm not sure how simple I can make that. Though maybe I can just hardcode a double click that does the raw interface.openWindow hardcoded and it will have the same issue. I'll have to try it and see. Will let you know if I can duplicate it in a simpler case.
SilentRuin
February 8th, 2021, 19:23
I'm not sure. Might be different ordering of operations in each field type.
Can you provide a simple extension that does this in CoreRPG; and I can take a look.
Regards,
JPG
Turns out that was simple. Now - I tried to hardcode things you have - but it does not matter if you do - bring up combat tracker - top left will be tiny field - next to it if you don't see the empty icon there will be a hand - double click either and your first image or a blank image window will pop up and show the behavior I'm talking about. Hopefully you've seen my TEST server thread as that ERROR is pretty serious for me - this one was just looking around for a workaround or something :)
Moon Wizard
February 8th, 2021, 21:40
Are you talking about this post?
https://www.fantasygrounds.com/forums/showthread.php?65798-Issues-Beta-Release-2021-02-Ruleset-Updates&p=577136&viewfull=1#post577136
JPG
Moon Wizard
February 8th, 2021, 21:56
It won't bring it to the top, if the window is already open. This is because openWindow, only opens the window (which places on top of window stack) if the window is not already open. You could add a w.bringToFront() call, after the openWindow call and w existence check, if you want to force that.
I'm not sure how you're extension is supposed to work after I load up.
Regards,
JPG
SilentRuin
February 8th, 2021, 22:51
It won't bring it to the top, if the window is already open. This is because openWindow, only opens the window (which places on top of window stack) if the window is not already open. You could add a w.bringToFront() call, after the openWindow call and w existence check, if you want to force that.
I'm not sure how you're extension is supposed to work after I load up.
Regards,
JPG
Yeah I'm not sure that answer (minus the workaround which I will try) makes much sense based on what is happening - as the window is NOT open.
To use this test (I cannot bring myself to call it an extension) you bring up combat tracker. You will see a tiny sliver of a stringcontrol (thin white box) above the eye icon (FGU 5E TEST). Double click it. A window or a blank new window will appear on top of combat tracker. Close it. Now to the right of that sliver is a tokenfield which may not really show but a hand will show - you'll know your over it. Double click on it. The new window will pop up BEHIND combat tracker. That is the problem. The code is super simple and you'll have no trouble understanding it. XML has stringcontrol and tokenfield with a double click calling the exact same logic.
Moon Wizard
February 8th, 2021, 23:04
Now that I think more about it, it most likely has to do with focus logic. Since the string control can get keyboard focus, and the token field can not; the keyboard focus is most likely setting the window back to top.
Is there a reason you are using an editable string control for this?
Regards,
JPG
SilentRuin
February 8th, 2021, 23:12
Now that I think more about it, it most likely has to do with focus logic. Since the string control can get keyboard focus, and the token field can not; the keyboard focus is most likely setting the window back to top.
Is there a reason you are using an editable string control for this?
Regards,
JPG
Yes :) I can give you a demonstration of combat groups if you like :)
Plus the editable string control is the one that WORKS as desired. The tokenfield does not.
Moon Wizard
February 8th, 2021, 23:27
You need to return true in the onDoubleClick event; so that it doesn't continue the default processing.
For strings, the double-click is captured.
For tokens, it is not, which means it passes to the window instance which moves the containing window to the top after the scripts are run.
Regards,
JPG
SilentRuin
February 8th, 2021, 23:30
You need to return true in the onDoubleClick event; so that it doesn't continue the default processing.
For strings, the double-click is captured.
For tokens, it is not, which means it passes to the window instance which moves the containing window to the top after the scripts are run.
Regards,
JPG
AHHHHHHH!!!! I knew this at one time - I got burned on this with openwindow before in another extension last year!!!!! THANK YOU.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.