Problem with resizing stack

Want to move your code and projects to LiveCode but don't know where to start?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller

Post Reply
KRY_M
Posts: 13
Joined: Sat May 04, 2019 3:43 pm

Problem with resizing stack

Post by KRY_M » Sat May 09, 2020 9:54 pm

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 921 times
Passionate developer :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4379
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with resizing stack

Post by richmond62 » Sun May 10, 2020 10:23 am

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.
Last edited by richmond62 on Sun May 10, 2020 4:29 pm, edited 1 time in total.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2464
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Problem with resizing stack

Post by jmburnod » Sun May 10, 2020 11:37 am

Hi,
if I need to resize things tend to code the resizing myself.
Me too
Best

KRY_M
Posts: 13
Joined: Sat May 04, 2019 3:43 pm

Re: Problem with resizing stack

Post by KRY_M » 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. 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
Passionate developer :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4379
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with resizing stack

Post by richmond62 » Sun May 10, 2020 4:22 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4379
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with resizing stack

Post by richmond62 » Sun May 10, 2020 4:27 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.
Why?
-
Screenshot 2020-05-10 at 18.25.11.png
-
Button "CLONE CARD":

Code: Select all

on mouseUp
   clone this card
   end mouseUp
Attachments
Resizerrr.livecode.zip
Here's the stack.
(1.36 KiB) Downloaded 11 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7668
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Problem with resizing stack

Post by FourthWorld » Sun May 10, 2020 4:56 pm

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.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

KRY_M
Posts: 13
Joined: Sat May 04, 2019 3:43 pm

Re: Problem with resizing stack

Post by KRY_M » Sun May 10, 2020 7:29 pm

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 !
Passionate developer :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4379
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem with resizing stack

Post by richmond62 » Sun May 10, 2020 7:55 pm

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

bwmilby
Posts: 296
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Problem with resizing stack

Post by bwmilby » Sun May 10, 2020 11:07 pm

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).
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

Post Reply

Return to “Converting to LiveCode”