Application window size

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Application window size

Post by bsouthuk » Tue Jun 09, 2009 12:17 pm

Hi - Wonder if someone can help me.

I've developed some software using Studio and am looking to distribute my application to other users within the next month or 2.

I am developing my application using my Vista 17" laptop - but when I open my application on a different computer ( I have tried 2 window xp's 15" monitor) the stacks are too big and will not fit on the screen.

Can anybody point me in the right direction to make my application fully viewable on all systems?

Thanks

Daniel

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Jun 09, 2009 1:18 pm

Hi Daniel,

I'm afraid you will have to define a minimum system (monitor) requirement
and develop in/for that resolution.

OR you will have to check "the screenrect" when your app starts and then scale windows/objects accordingly, most unlikely!


Best

Klaus

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Jun 09, 2009 1:42 pm

Hi Daniel,

Surely, it is possible to adjust stack windows to screen size and to scale all objects on the stack window accordingly. It might be a bit tedious, but actually it isn't really difficult. Here's a simple example:

Code: Select all

on preOpenStack
  put the screnrect into myRect
  subtract 64 from item 3 of myRect
  subtract 64 from item 4 of myRect
  set the rect of this stack to myRect
  set the loc of this stack to the screenLoc
  resizeStack
end preOpenStack

on resizeStack
  lock screen
  put the rect of this cd into myRect
  put the topLeft of fld 1 into myTL
  set the width of fld 1 to the width of this cd / 2
  set the height of fld 1 to the height of this cd / 2
  set the topLeft of fld 1 to myTL
  set the bottom of btn 1 to the bottom of fld 1
  set the left of btn 1 to the right of fld 1 + 32
  unlock screen
end resizeStack
To run this example, just create a new stack with one field and one button and include above scripts in the stack script. If I didn't write any typos, the two objects should move automatically relative to the size of the stack window.

I know that people tend to use Rev's built-in geometry manager for this, but the GM will always reach its limits in more complex projects. A custom script like the one above is probably the most reliable solution.

Best regards,

Mark
Last edited by Mark on Tue Jun 09, 2009 1:48 pm, edited 1 time in total.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Post by bsouthuk » Tue Jun 09, 2009 1:44 pm

Brilliant! thanks Mark

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Jun 09, 2009 1:49 pm

bsouthuk wrote:Brilliant! thanks Mark
I had not finished writing yet, but somehow my message got posted before i finished it. You got the entire script now.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Tue Jun 09, 2009 4:24 pm

I tend to make my programs with a starting window size of just under 640x480 and allow for resize and saving their windows size for when they next use my program. The reason I pick this size is that it is pretty much the old school size from say Windows 3.0 and 3.1 days. I'd say that nobody actually uses this size anymore, but I would suspect that there may be a rare user or two out there still using this screen resolution. I'd say that 800x600 would be the bare minimum really. There's probably still a small handful of users out there using this resolution. I would like to think that 1024x768 is currently the most used resolution, or 1280x1024.

I myself am using a resolution of 1440x900. I've run into a few apps that were intended for 1280x1024 and will not fit on my screen. Most were resizable, but some were not and I had to uninstall them and not use them.

Always try to make your programs with the ability to resize them if you can. You can set the minimum size on the properties windows of the rev ide when you're working on your project under the Size section.

If you hardcode a mandatory size, you may leave some users out in the cold. So try to avoid doing that unless it's utmost necessary.
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Tue Jun 09, 2009 4:46 pm

The site I check for display stats is:
http://www.w3schools.com/browsers/browsers_display.asp

Here's the current lineup as of January 2009:
Unknown: 3%
640x480: 0%
800x600: 4%
1024x768: 36%
Higher: 57%

What's missing from that list is the penetration of WSVGA (1024x600) used on many netbooks (EeePC, Aspire One, the rumored tablet from Apple said to be coming in October, etc.).

Lately I've been optimizing for 1024x768 but list 1024z600 as a minimum, and try to accommodate that whenever I can for the netbook market.

And as Garrett noted, you'll want to leave some margin for the OS X Dock and Windows/Linux Task Bar.

Mark's tip on the resizeStack message is invaluable. Rev also includes a Geometry Manager to help with handling resizing of simple layouts, but I love the control and freedom of handling it directly myself. It takes only a couple minutes to write, and leaves you fully in the driver's seat for precise location of controls.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Post by bsouthuk » Tue Jun 09, 2009 5:35 pm

Hey Mark

Have copied your scrypt in a new stack but the button and field do not move even though i've named them both "1"

Not sure if i've doing anything wrong?

Cheers

Daniel

Post Reply