Page 1 of 3

Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 1:26 am
by stam
Hi all,

I'm sure this is a bug - but seems weird as there is no mention of this anywhere, so just double checking.

Maximising the window by making it full screen on mac does not appear to trigger the on resizeStack handler

i.e. clicking on the green window decoration resizes the stack to make it full screen but doesn't trigger the on resizeStack, even though GM rules work appropriately.
maximise.jpg
While the GM is working fine and resizes/moves controls, i also call a handler from on resizeStack to resize the text of a field depending on it's size.

Resizing the stack any other way works beautifully but going full screen does nothing... easy to check by adding a line to put a message in the message box inside the resizeStack handler - definitely doesn't fire going full screen...

Is this expected behaviour? is behaviour similar on Windows?

Many thanks
Stam

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 8:20 am
by richmond62
Well I just discovered something (and I really don't know what made me think of it):
-
SShot 2022-02-09 at 9.05.40.png
-
And I can imagine some pseudocode a bit like this:

.....
if the fullscreen of stack "XYZ" is true then
-- do something exciting
end if
.....

-
SShot 2022-02-09 at 9.17.03.png
-
I really need to get out more often. :wink:

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 9:29 am
by richmond62
Unfortunately this sort of thing:

Code: Select all

on resizeStack
   if the fullScreen of stack "XYZ" is true then
      set the backGroundColor of stack "XYZ" to red
   else
      set the backGroundColor of stack "XYZ" to white
      end if
   end resizeStack
does not work.

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 9:45 am
by stam
Yep that’s my problem - I’d need to be able to trap the message; the only way to use a property would be to continuously poll the property which I really don’t want to do.

Given that the stack is being resized (and actually this is recognised by the Geometry Manager, which resizes and moves fields appropriately, but unfortunately won’t let me execute code like changing font size), I’d consider this incorrect functionality/bug — unless of course there is a different message sent by going to/leaving fullScreen….

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 10:29 am
by stam

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 10:45 am
by bn
Hi Stam,

I did a little test with a stack and 1 field. The field should resize when the stack is resized or going to fullscreen.

The card script is

Code: Select all

on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
   beep
   set the textSize of field 1 to random(25) + 10
   pass resizeStack
end resizeStack
This works also for fullscreen.

Trapping "resizeStack" this way has to pass "resizeStack" for the GeometryManager to kick in.
This is on MacOS 10.14.6 "Mojave"

Kind regards
Bernd

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 12:05 pm
by stam
Hi Bernd - you are quite correct.

I just started with a new stack and the resizeStack handler does indeed trigger on going fullscreen.

Not sure why it's not working in my app :-/
It works fine on resizing the stack but nothing happens on going fullscreen...

Back to more head scratching...

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 12:13 pm
by Klaus
I found that even after setting the stack to FULLSCREEN this way (green button)
-> the fullscreen of this stack
still returns FALSE!?

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 12:59 pm
by stam
I suspect that property may be for mobile only?

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 1:02 pm
by Klaus
No, for all platforms!
This returns TRUE:

Code: Select all

...
set the fullscreen of this stack to TRUE
answer the fullscreen of this stack
...

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 2:05 pm
by richmond62
I assume that setting the fullScreen via the green window button
fails to set the fullScreen property in the stack, just sends a system message.

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 2:20 pm
by Klaus
Really? :D

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 2:27 pm
by richmond62
Really! :wink:

Re: Going fullscreen doesn't trigger resizeStack

Posted: Wed Feb 09, 2022 9:44 pm
by stam
bn wrote:
Wed Feb 09, 2022 10:45 am
I did a little test with a stack and 1 field. The field should resize when the stack is resized or going to fullscreen.
Hi Bernd - my problem remains. I've attached a stripped down version of my implementation.

The handler that resizes text (dynamicTextResize) is in the field script (normally a behaviour and more complex, but simplifying here...). This is also triggered by textChanged.
The min/max font sizes are set as custom props of the field
The GM is set to scale the field with the stack size.
The resizeStack handler calls the dynamicTextResize

When resizing he stack manually all is peachy. If i maximise the field by double-clicking on the titlebar, it fills the screen (but is not fullscreen) and everything scales nicely with a nice increase in textSize.

If I instead click the green decoration button (on mac) to go into fullScreen the field scales in size appropriately (so the GM call is fine) but the text does not scale in size. In this state however if i exit full screen, the text appears too large (as in, it appears scaled up for fullScreen) and if i resize it jumps down to normal size.

Very grateful if someone cleverer can figure out what's going on :-/

the field script is:

Code: Select all

on dynamicTextResize
    lock screen
    local tSize, tMin, tMax
    put the uMinTextSize of me into tMin
    put the uMaxTextSize of me into tMax
    
    set the textSIze of me to tMin
    if the formattedHeight of me + 12 > the height of me  then exit dynamicTextResize
    repeat until the formattedHeight of me >= the height of me -12
        put the textSize of me  + 1 into tSize
        if tSize <= tMax then 
            set the textSize of me to tSize
        else
            exit dynamicTextResize
        end if
    end repeat
end dynamicTextResize

on rawKeyDown
    dynamicTextResize
    pass rawKeyDown
end rawKeyDown
and the stack script is

Code: Select all

on resizeStack
    send "dynamicTextResize" to field 1
    pass resizeStack
end resizeStack
With any kind of resizing except going full screen this works great. However on full screen the as mentioned resizing of the field works but the text is not resized...

Re: Going fullscreen doesn't trigger resizeStack

Posted: Thu Feb 10, 2022 1:43 am
by bn
Hi Stam,

if you change the script of the stack to

Code: Select all

on resizeStack
   if the mouse is not down then
      send "dynamicTextResize" to field 1 in 10 milliseconds
   else
      send "dynamicTextResize" to field 1
   end if
   pass resizeStack
end resizeStack
does it do what you want?

Kind regards
Bernd