Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I Place Form Scrollbars Dynamicly?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Is it possible to use scrollbars only if screenwidth is to small?
I designed forms for 768 width
I recent had to use old laptop with only 800x600 screen.
Then I got idea to dynamicly use form scrollbars.
Put code in init but no effect.
Also tried in load again no succes.
Is this ompossible?

TIA
-Bart

Code:
LOCAL lnScreenWidth

lnScreenWidth = SYSMETRIC(1)
=MESSAGEBOX(TRANSFORM(lnScreenWidth))

IF lnScreenWidth <= 600
	thisform.ScrollBars = 1
ENDIF
 
Bart,

According to the Help topic on ScrollBars:

The Scrollbars property setting is evaluated for a form when the form is instantiated.

That suggests that you can't set them at run time.

Keep in mind that, if the screen is so large that the scrollbars are unnecessary, they will be disabled.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,
Thanks so far. I just checked with a project and indeed it gives the effect I look for.
Than I started a new (trial) project and could not get same effect. i.e. I set thisform.scrollbars to 2 but no scrollbars appeared.
Has to do with an other command / setting?
-Bart
 
Furthermore, the help states that it is read-only at run time.

Bart, if you set ScrollBars to 1 for horizontal, then the scroll bar only appears when the form is too narrow to show all the controls on it (although for some reason it appears not to react with controls that are in the class that the form is based on).

So if the screen is too narrow to show the whole form, just make the form narrower in the Init event and the scroll bar will automatically appear if needed.

Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Actually, Scrollbars isn't read-only at runtime. However, for a form, you have to set it to a non-0 value at design-time in order to be able to have scrollbars at all at run-time. Once you do that, you can change it dynamically.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top