Page 1 of 1
Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 2:45 pm
by DR White
I developed my 768 x 1024 card on a 1920 x 1200 screen.
Now I need it to run on my wife's laptop screen which is 1280 x 800.
How can I re-size my card to fit 1280 x 800 laptop screen?
Thanks,
David
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 2:56 pm
by chris25
as a complete novice here - I was wondering whether or not you had come across the "screenrect" command? Or am I really missing the boat?
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 3:01 pm
by DR White
I have never heard of "screenrect".
I just now looked up in the dictionary, (The screenRects function returns a return-delimited list of four integers, separated by commas.)
How do I use it to re-size my screen after I have complied it to an exe?
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 3:47 pm
by chris25
Unfortunately I am at your level here. You mentioned exe so I assume you have a windows environment. Well my first guess in your situation would be to go back to your orginal stack and go to the first stack, enter an "on preopen" handler
the screenRect
set the rect of this stack ?(something to do with resolution of the screen I presume)
screenRects
Find out how to do this and then re-create your stack as a standalone again and ditch the first one.
As I said I have not had any time to experiment with this situation, I have only spent a few moments looking it up. Sorry I can not take you further at this stage.
regards
Chris
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 4:14 pm
by DR White
Chris,
Thanks for your time,
David
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 6:41 pm
by shawnblc
What about something like this -
Code: Select all
on preOpenStack
set the fullscreen of the stack "testStack" to true
end preOpenStack
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 7:14 pm
by jacque
You'll need to write a handler that loops through all the controls and repositions them on every card. Typically this goes into a resizeStack handler (a resizeStack message is sent whenever the user drags the resizer handle at the lower right of the window.) Since you want it to run automatically when the stack opens on a smaller screen, you can call that handler yourself on preOpenStack:
Code: Select all
on preOpenStack
set the height of this stack to 800 -- I'm assuming the width stays the same
resizeStack
end preOpenStack
on resizeStack
-- all resizing goes here
-- it's likely to be a pretty long handler depending on the number of objects
end resizeStack
Resizing is a pain, you must account for every object in the stack. To make it somewhat easier, LiveCode provides the Geometry Manager. You can read about that in the User Guide. It requires setting up every object in the stack with geometry information; after that the objects will reorient themselves to your settings.
Many of us have had inconsistent results with the geometry manager and prefer to write our own resizing scripts. Either way, it's a tedious affair. Another approach would be to create a substack at the other size and just manually position the objects once. That's not the best solution though because any change in script will require you to change it in two places, and you will also have duplications of every object which increases the stackfile size. Resizing is a better approach.
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 8:05 pm
by DR White
Jacque,
The is a very graphic application consist of 100+ objects, including spinning stars.
How has everyone written programs (over the years) for desktops, that may need to run on several different size display screens?
Thanks,
David
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 8:20 pm
by FourthWorld
DR White wrote:How has everyone written programs (over the years) for desktops, that may need to run on several different size display screens?
When I first got started, all Macs were 512x342, and Windows hadn't been invented yet. By the time Windows came along Macs started shipping with multiple resolutions, and before you knew it 1990 was upon us and suddenly we couldn't avoid having many different screen sizes to support.
The resizeStack message is your friend.

Sure, takes a bit of work, but you only write a resizeStack handler once and it's beautiful to see how gracefully your work adapts to any screen.
The specifics of what changes size and what merely moves when a stack is resized will depend on the nature of the layout itself. When in doubt, you can almost always find some example in the wild of another app that's had to solve the same problem.
And if you need, you can also constrain resizing, allowing vertical resizing at a fixed width or vice versa. See the minHeight, minWidth, maxHeight, and maxWidth properties.
Re: Sizing Desktop Displays?
Posted: Sun Nov 03, 2013 8:21 pm
by jacque
I think everyone has a different approach to the problem, but a very common one is to just create the stack at the smallest acceptable size in the first place and then require a monitor of at least that size in the application specs. That's why you'll see commercial software with a list on the side of the box that includes a minimum monitor resolution. (At least, we used to see that back when software shipped in boxes.)
In your case, that would mean changing the height of your stack to 800 pixels and manually rearranging the objects. You'd only need to do that once and then it would run on all your machines.