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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms that scroll

Status
Not open for further replies.

crossface

Programmer
Nov 30, 2002
81
US
I would like to create a form that will scroll

I design in 800 x 600

I would like to have more items on my form than can be shown on this size form.

I would like a vertical scroll bat.

Can someone give me a simple example how this would work

I would like to do it on a form with Page frames.

Kevin Cotter
Byron Schools
 
Kevin,
First it's usually not a good idea to mix a Pageframe implementation with a scrolling form - it can confuse the user.

To have a scrolling form, just set the form Property - Scrollbars to 1, 2 or 3 - Horizontal, Vertical or Both. Note: You can't change this setting programatically once the form is visible.

You should also be aware that you'll need to add you own code if you want the form to "scroll" with your data entry automatically. Normally if the user tabs or the program sets focus to a control that isn't in the visible area the form won't care - the user will have to scroll manually to that control.

Rick
 
Hi
The following code will scroll automatically the form if the control that receive focus is not visible, but it needs to be in all base classes (here i mean subclassed VFP base classes, at least is what I do) When or GotFocus event.
It uses absolute coordinates,so controls can be in container or pages.
Code:
IF this.Tag = 'isfirst'  && identify the top control
	thisform.ViewPortTop = 0
	return
ENDIF 
IF OBJTOCLIENT(this,1) < thisform.ViewPortTop 
	thisform.SetViewPort(0,OBJTOCLIENT(this,1)- 8 )
ENDIF
IF OBJTOCLIENT(this,1)+this.Height > thisform.ViewPortTop + thisform.ViewPortHeight 
	thisform.SetViewPort(0,OBJTOCLIENT(this,1)+this.Height + 8 -thisform.ViewPortHeight)
ENDIF
 
Mike,
I fully agree, the only reason to deal with scrolling forms is in the case where your application normally requires a given resolution - e.g. 800x600, but you need to have it availble to someone that occasionally needs it at 640x480. (Adjust the resolution numbers to meet your 'reality'. :))

Rick
 
Rick,

the only reason to deal with scrolling forms is in the case where your application normally requires a given resolution - e.g. 800x600, but you need to have it availble to someone that occasionally needs it at 640x480.

Yes, that makes a lot of sense. It's better than designing for the lower resolution when only a few users require it.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top