Page 1 of 1

Problem with resizing stack

Posted: Sat May 09, 2020 9:54 pm
by KRY_M
I have a new and strange problem, I made a stack for a mobile app I placed and set all the geometry settings, for all my rounded rectangles to resize when i manually resize the stack, after some tests it worked as expected.
I made a group out of my controls to be able to set them as background controls (shared among my cards). The problem is that I can't resize them as before, I broke them back into separate objects, but now they behave strangely, all are aligned and have the same size an settings in the geometry but some of them are moving and some of them are different size at the end of the resize.
My app will use some imported data from XML every record is a new card (200-300), and I want to implement some kind of diagnose app with pre recorded logic diagrams, stored in XML files, something modular and a little complex.
A startup stack as splash screen then a second card will be used as a starting point for the different diagrams stored in different stacks with similar look but different data.
And de IDE crashed a few times in row, the IDE works slowly.. I can't find the cause an I really need to make them background group form making exact copies of the card when I import all that data. Maybe there is a better solution to achieve this but I don't know it yet.
P.S. how to debug hanged IDE + app ?? (Windows 10 -64 bit app, Indy 9.6 dp4)
Thank you
Capture.JPG
Capture.JPG (23.04 KiB) Viewed 23037 times

Re: Problem with resizing stack

Posted: Sun May 10, 2020 10:23 am
by richmond62
Personally I have very little time for the Geometry Manager, and, if I need to resize things tend to code the resizing myself.
-
Screenshot 2020-05-10 at 12.22.28.png
-
Attached stack removed as updated version uploaded further down the thread.

Re: Problem with resizing stack

Posted: Sun May 10, 2020 11:37 am
by jmburnod
Hi,
if I need to resize things tend to code the resizing myself.
Me too
Best

Re: Problem with resizing stack

Posted: Sun May 10, 2020 3:20 pm
by KRY_M
My main problem is that all my controls need to be inside the group to be able to copy them to all the cards I make using new card command. If I make o group I can't make all the objects inside to resize as it should. I read a lot of post about resizing controls.. I got very confused about some Rectangles, about some custom resizing techniques I don't know how to adapt to my app. Where can I read about the events and the values of the resized group ? I will make the resizing manually after I understand what really happens when I drag the corner of the group.
Thank you

Re: Problem with resizing stack

Posted: Sun May 10, 2020 4:22 pm
by richmond62
If your problem is that you wish the field and the buttons to resize when you resize your stack
I don't know why you need to place them in a group.

If you downloaded my stack and tried to resize it (by dragging on the bottom, right hand corner), everything resizes despite
not being in a group:

stackScript:

Code: Select all

on resizeStack nWIDD, nHITE, oWIDD, oHITE
   put nWIDD/oWIDD into WIDDprop
   put nHITE/oHITE into HITEprop
   put nWIDD/2 into LATERALc
   put nHITE/2 into VERTICALc
   ---- resize and position field "ff" ----
   put ((the width of fld "ff") * WIDDprop) into fWIDD
   set the width of fld "ff" to fWIDD
   put ((the height of fld "ff") * HITEprop) into fHITE
   set the height of fld "ff" to fHITE
   set the loc of fld "ff" to LATERALc,VERTICALc
   set the top of fld "ff" to 20
   ---- resize and position button "Button 1"
   put ((the width of btn "Button 1") * WIDDprop) into b1WIDD
   set the width of btn "Button 1" to b1WIDD
   put ((the height of btn "Button 1") * HITEprop) into b1HITE
   set the height of btn "Button 1" to b1HITE
   set the loc of btn "Button 1" to LATERALc,VERTICALc
   put the bottom of fld "ff" into BUM
   set the top of btn "Button 1" to (BUM + 40)
end resizeStack

Re: Problem with resizing stack

Posted: Sun May 10, 2020 4:27 pm
by richmond62
My main problem is that all my controls need to be inside the group to be able to copy them to all the cards I make using new card command.
Why?
-
Screenshot 2020-05-10 at 18.25.11.png
-
Button "CLONE CARD":

Code: Select all

on mouseUp
   clone this card
   end mouseUp

Re: Problem with resizing stack

Posted: Sun May 10, 2020 4:56 pm
by FourthWorld
KRY_M wrote:
Sun May 10, 2020 3:20 pm
My main problem is that all my controls need to be inside the group to be able to copy them to all the cards I make using new card command. If I make o group I can't make all the objects inside to resize as it should.
By default, groups will resize themselves to fit the controls within them. When making layouts with the pointer tool this is often useful. But when scripting the positions of objects this may make for unpredictable results, esp. where controls inside the group cause the group to resize, while others in the group use the group's bounds to determine their position.

The solution for effective scripting of objects within a group is easy enough: set the lockLoc property of the group to true. Then you can position controls however you like and they'll never change the rect if the group itself.

Also, you may not need to copy the group to each card. You can see the group's sharedBehavior to true, and then any subsequent "new card" command issued while a card with a shared group is the current card will be created with the shared group automatically placed on the new card.

Re: Problem with resizing stack

Posted: Sun May 10, 2020 7:29 pm
by KRY_M
Thank you for all your answers, but I think I will choose the easiest route, to use my current layout without the group and to clone the card ! I didn't know about this command. Resizing all the controls requires a lot of calculations and a lot of tests... When I will need to do something more complex with a layout I will try to use your very good examples.
Thank you again for support !

Re: Problem with resizing stack

Posted: Sun May 10, 2020 7:55 pm
by richmond62
Resizing all the controls requires a lot of calculations
Not really . . .

I gave Primary children (9-10) years old this problem a year ago and they managed it in 60 minutes . . .

It is just a bit of Baby Mathematics. 8)

Have a look at my code and you will see that it is NOT difficult.

If it were difficult I would not have managed it: my Mathematics go stuck at Calculus. :?

Re: Problem with resizing stack

Posted: Sun May 10, 2020 11:07 pm
by bwmilby
Going back to your initial post... not sure you really need to make multiple cards. You could easily use the card as a template and populate the data into the card on the fly. LiveCode is better suited to this type of model than having a bunch of cards to hold the data.

If you still want to use the group/multiple card method, then you should still be able to use the geometry manager. In this case, you would NOT want to lock the location of the group. You may need to manually have the GM settings recalculated after grouping (revCacheGeometry from the message box - I actually used this command quite a bit when using GM). You should visit the GM settings for each control and be sure they are referenced properly. And be sure to save the stack before you do any resizing so if there is a mistake it is easy to revert without too much effort.

I spent a good bit of work making the GM work on mobile and fixing a few bugs, but am now pretty much writing my resize handlers by hand. I actually wrote some general handlers to do some of the work as well (position controls based on the loc relative to design card size, have not written handlers to resize controls - I do that by hand).

Re: Problem with resizing stack

Posted: Wed Jun 10, 2020 6:22 pm
by sphere
there is also a very nice example stack for Group Resize made by Bernd Niggemann, see example stack from within the IDE, i thought i got it from there