Page 1 of 1

resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 5:24 pm
by dandun
Hello,
I am currently trying to determine the optimal way to position/resize controls on a mobile app. I and am confused when to use resizeControl vs ResizeStack.
I have seen both used in similar aspects to set the positions but am unsure what the drawbacks of one over the other are.

Thank you
Dan

Re: resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 7:36 pm
by dunbarx
Hi.

I don't do mobil so there may be subtle usage issues, different than with desktop.

These are messages sent when either a control or a stack is resized under user (not script) control. So one is sent when the window (card) is resized (this is not terribly common) and the other when, say, a field is resized. Your question almost seemed as if you considered these commands, rather that messages. They do not "set" anything, as a command would. They respond to engine processes, and can be used to perform other tasks once those actions terminate.

This distinction must be understood. It is fundamental to the structure of LC. Do you still have questions about this?

Craig Newman

Re: resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 8:48 pm
by dandun
Hi Craig,

I realize that there is many ways to to get at the same end result, and this just might be one of them. I was looking at two examples of mobile app projects and you are correct I am specifically referring to how these are used in the following examples, just not sure if there is a reason to use one over the other or does it not matter.

resizeStack
send "resizeImages" to card "images" of stack "resources"
layoutNavigation
end resizeStack

on layoutNavigation
put 1 into tScale

put the width of this stack into tStackWidth
put the height of this stack into tStackHeight

## Use 2% of the width or height for spacing
put (tStackWidth * 0.02) into tHorizontalSpace
put (tStackHeight * 0.02) into tVerticalSpace

put (tStackHeight * 0.115) into tTopBackgroundHeight
put (tStackHeight * 0.1125) into tBottomBackgroundHeight

set the width of image "background.png" of me to tStackWidth
set the height of image "background.png" of me to tStackHeight
set the topLeft of image "background.png" of me to 0,0
## Resize and position the top nav
set the top of button "Add" of me to (tStackHeight * 0.02)
set the left of button "Add" of me to (tStackWidth * 0.02)
end layoutNavigation

on preopencard
## Ensure the card is laid out correctly
layoutCard

## Pass preOpenCard so the navigation background group receives it and lays itself out
pass preOpenCard
end preopencard

on resizeStack
## Tell the resources stack to resize all the images relative to the new stack size
send "resizeImages" to card "images" of stack "resources"
layoutCard
pass resizeStack
end resizeStack

Or in the below example a similar approach using resizeControl

on resizeControl
lock screen
lock messages
set the lockloc of me to true

local tShadowSize, tShadowOffset
put the height of me / 10 into tShadowSize
put tShadowSize / 30 into tShadowOffset

set the rect of graphic "background" of me to the rect of me

set the width of field "title" of me to the width of me
set the loc of field "title" of me to the loc of me
set the left of field "title" of me to the left of me
set the top of field "title" of me to the top of field "title" of me – tShadowOffset

set the lockloc of me to false
unlock messages
unlock screen
end resizeControl

Thanks
Dan

Re: resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 10:34 pm
by Simon
Hi Dan,
I'm not sure of your requisites but take a look at this lesson:
http://lessons.runrev.com/m/4069/l/1564 ... ll-devices

Simon

Re: resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 11:09 pm
by dandun
Thank you Simon, that answers my questions between the two. But that article now raises a new question. If you were creating a mobile app today, Would you continue to use the "manual" layout or use the "fullscreen" property that was introduced in 6.5?

Re: resizeControl vs ResizeStack

Posted: Sun Jun 22, 2014 11:20 pm
by Simon
fullscreen for sure!
If you don't mind a little lost real estate, but from the images you posted there is lots of room.

Simon