tags:

views:

105

answers:

4

Hi everyone I have developped an app on 22inch monitor at its max resolution when I run this on a laptop with a different ratio and a smaller resolution well the form is too big - to be expected but no scroll bar appear automaticaly to see the whole thing if needed I have tempered with all options but could not figure it out I have tried autoscroll of course but nothing I am sure it is not so difficult but I am stuck So if anyone could indicate me what properties to change I'll be most greatful or even better some easy strategy or components (even paying) to achieve a better screen resolution independance but the scrollbar would be great to start with Thanks & Regards Philippe Watel

A: 

Set AutoScroll = True and BorderStyle = bsSizeable to get your existing form working. AutoScroll only kicks in if your form is made smaller for the content, but that doesn't happen if BorderStyle is set to something that doesn't allow resizing.

Then when you've got some time on your hands look into the TScrollBox and design your form to scale nicely; Put the stuff that can't scale on the ScrollBox (so you've got control over what scrolls and what doesn't scroll).

Cosmin Prund
Hi thanks for answeringMy borderstyle is Siszable, still no effectdo the experiment create a new applicationoncreate event of the main form self.height := screen.Height * 2, set autoscroll := truewhen you run it the form is very high but no scrollbar appears I am missing something or whatByepw
Philippe Watel
Start a new application, put a single control (any control) on a form, start the program, at runtime resize your form so your single control is no longer visible: scrollbars will show up. Scrollbars are relative to the content of your form, not to the visible size of your display. There's nothing stopping you from making your forms twice the height of the screen and drawing things in the invisible parts of the form. Just as there's nothing stopping you from moving the form at negative coordinates!
Cosmin Prund
What you are requesting, is a scrollbar on the desktop, not the form.If you make your form twice as large as your screen, there will be no scrollbars anywhere to scroll your form into view.
Vegar
A: 

Autoscrolling kicks in when you make the form narrower than the right side of its right most control and/or make the form shorter than the bottom of its bottom most control. If there are no controls on the form, I think it wouldn't sprout any scroll bars no matter how small you size it.

What you are looking for is not just autoscrolling, but auto-resizing of a form based on the current screen dimensions as well. There is no "auto" property for this. You will have to deal with it yourself when you create / show the form.

In OnCreate (or the constructor itself after the inherited call):

Height := Screen.Height;
Width := Screen.Width;
Marjan Venema
A: 
Philippe Watel
This should have been an EDIT to your original post (that's how StackExchange works). Because this wasn't an edit of the original post, only now did I noticed it's your own "answer". Anyway: In my opinion you need to go back to your original Desktop PC and re-design your form to work for the smallest screen it needs to work on. If you need to control what scrolls and what doesn't scroll, use a TScrollBox. If you need ideas on how to re-design the form you might want to upload a screenshot somewhere.
Cosmin Prund
A: 

As I commented on Cosmins answer, I think you have missunderstud something here. A scrollbar is shown inside a container, if the content of that container is larger then the clientarea of the same container.

By larger then, I mean 1. a child component have a width or height greater then the containers width or height, or 2. a child component is placed where some or all of it is outside of the containers client area.

What you describes, is a form that is large enough to display all its content, but too large for the current desktop resolution.

eg. a form that is 1600x1200 pixels on a computerscreen with 1280x1024 resolution.

In such a case, ther will be no scrollbars, and if there would be scrollbars, the scrollbars should be on the desktop, which is the container that the form is inside, not the form.

What you should do, is to ensure that your main form is not larger then the desktop. If you shrink your forms bounderies, it will start clipping the content, and scrollbars should appear.

Vegar