Page 1 of 1

Strange effect with geometry scaling

Posted: Fri Jun 23, 2017 6:48 pm
by mvillion
Hi

I have an app that its minimum size is 1024 x 768 and you can grab the corner and scale it bigger.
I have two cards in that app
I have a datagrid in both.
I have set up the properties of those datagrid to resize according to the window size using geometry.
When I grab the corner and manually resize, both works perfectly. The window resizes and the datagrid scales accordingly.
BUT
If I maximise the window and enter the cards, one data grid correctly rescales to the full window size and one does not.
The one that does not will rescale as soon as I unmaximise the windows and drag the corner.

I have check the geometry and both are identical in the scale to RIGHT and BOTTOM are selected and nothing else.

I do not know what the difference is or how to ask Livecode to check geometry.

Any ideas?

Re: Strange effect with geometry scaling

Posted: Tue Jun 27, 2017 12:16 pm
by MaxV
When you switch card the resize message is not sent to the card, so it's remain to the old size value.
so you need to use this trick:

Code: Select all

on OpenCard
   put the width of me into tx
   set the width of this stack to (tx + 1)
end OpenCard

Re: Strange effect with geometry scaling

Posted: Tue Jun 27, 2017 1:05 pm
by [-hh]
Yet another option is to use revUpdateGeometry.

Re: Strange effect with geometry scaling

Posted: Tue Jun 27, 2017 5:32 pm
by jacque
Just send the resizestack message yourself:

Code: Select all

on preopencard 
  resizestack 
end preopencard

Re: Strange effect with geometry scaling

Posted: Wed Jun 28, 2017 9:27 am
by MaxV
jacque wrote:Just send the resizestack message yourself:

Code: Select all

on preopencard 
  resizestack 
end preopencard
This get the error no message found.

Re: Strange effect with geometry scaling

Posted: Wed Jun 28, 2017 8:36 pm
by jacque
MaxV wrote:
jacque wrote:Just send the resizestack message yourself:

Code: Select all

on preopencard 
  resizestack 
end preopencard
This get the error no message found.
It would depend on where the resizeStack handler is located, and if there is one. If the developer hasn't created a resizeStack handler then it won't be found. Also, I should have added the parameters to the call:

Code: Select all

on preopencard 
  resizestack the width of this stack,the height of this stack
end preopencard

Re: Strange effect with geometry scaling

Posted: Thu Jun 29, 2017 3:13 pm
by MaxV
Jacque,
your code create errors.
You can't use that way. At least not in Livecode 9.
You can't call resizeStack message. You can use only this way:

Code: Select all

on ReasizeStack
   ...
   pass resizeStack
end ResizeStack

Re: Strange effect with geometry scaling

Posted: Thu Jun 29, 2017 8:14 pm
by jacque
I've called resizeStack in several apps without errors, but the stack does have to have a resizeStack handler in the message hierarchy where the engine can find it. However, I see now that that OP isn't using a resizeStack handler at all, he's using the geometry settings.

In that case, he should call "revUpdateGeometry" instead and it should work.

Re: Strange effect with geometry scaling

Posted: Sat Jul 01, 2017 3:28 pm
by mvillion
Ok. Thanks peeps for the guidance.

I have found the perfect solution combining the best of all entries


on preopencard
put the width of me into tx
set the width of this stack to (tx + 1)
end preopencard

Simples