Going fullscreen doesn't trigger resizeStack

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 1:26 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Going fullscreen doesn't trigger resizeStack

Post by richmond62 » Wed Feb 09, 2022 8:20 am

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:
Attachments
Expander.livecode.zip
Here's the stack.
(204.31 KiB) Downloaded 54 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Going fullscreen doesn't trigger resizeStack

Post by richmond62 » Wed Feb 09, 2022 9:29 am

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.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 9:45 am

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….

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 10:29 am


bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by bn » Wed Feb 09, 2022 10:45 am

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
Attachments
geometryAndResizeStack.livecode.zip
(1.34 KiB) Downloaded 72 times

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 12:05 pm

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...

Klaus
Posts: 14189
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Going fullscreen doesn't trigger resizeStack

Post by Klaus » Wed Feb 09, 2022 12:13 pm

I found that even after setting the stack to FULLSCREEN this way (green button)
-> the fullscreen of this stack
still returns FALSE!?

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 12:59 pm

I suspect that property may be for mobile only?

Klaus
Posts: 14189
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Going fullscreen doesn't trigger resizeStack

Post by Klaus » Wed Feb 09, 2022 1:02 pm

No, for all platforms!
This returns TRUE:

Code: Select all

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Going fullscreen doesn't trigger resizeStack

Post by richmond62 » Wed Feb 09, 2022 2:05 pm

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.
Last edited by richmond62 on Wed Feb 09, 2022 2:26 pm, edited 1 time in total.

Klaus
Posts: 14189
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Going fullscreen doesn't trigger resizeStack

Post by Klaus » Wed Feb 09, 2022 2:20 pm

Really? :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Going fullscreen doesn't trigger resizeStack

Post by richmond62 » Wed Feb 09, 2022 2:27 pm

Really! :wink:

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by stam » Wed Feb 09, 2022 9:44 pm

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...
Attachments
dynamicTextResize.livecode.zip
(2.92 KiB) Downloaded 57 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Going fullscreen doesn't trigger resizeStack

Post by bn » Thu Feb 10, 2022 1:43 am

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

Post Reply