Problem with resizing stack
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller
Problem with resizing stack
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
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
Passionate developer
-
- Livecode Opensource Backer
- Posts: 9443
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Problem with resizing stack
Personally I have very little time for the Geometry Manager, and, if I need to resize things tend to code the resizing myself.
- -
Attached stack removed as updated version uploaded further down the thread.
- -
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.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Problem with resizing stack
Hi,
Best
Me tooif I need to resize things tend to code the resizing myself.
Best
https://alternatic.ch
Re: Problem with resizing stack
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
Thank you
Passionate developer
-
- Livecode Opensource Backer
- Posts: 9443
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Problem with resizing stack
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:
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
-
- Livecode Opensource Backer
- Posts: 9443
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Problem with resizing stack
Why?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.
- -
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 319 times
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Problem with resizing stack
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Problem with resizing stack
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 !
Thank you again for support !
Passionate developer
-
- Livecode Opensource Backer
- Posts: 9443
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Problem with resizing stack
Not really . . .Resizing all the controls requires a lot of calculations
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.
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
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).
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
Script Tracker https://github.com/bwmilby/scriptTracker
Re: Problem with resizing stack
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