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

Adjustable FoxPro Screen

Status
Not open for further replies.

moppsy

IS-IT--Management
Dec 22, 2004
22
US
I would like my FoxPro 6.0 application to have an adjustable screen that allows the automatic minimizing and maximizing of the viewing area so I don't have to use a scroll bar. Is there anyway for automatically adusting the viewing area of the application? Thanks in advance
 
Moppsy

I would like my FoxPro 6.0 application to have an adjustable screen that allows the automatic minimizing and maximizing of the viewing area

What do you mean by "automatic"? The user can already minimise and maximise by clicking the appropriate buttons in the title bar, just like in every other Windows application. You don't need to do anything special to achieve that.

If that's not what you want, please clarify the question.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks for the feedback. We are trying to maximize the actural objects on the form rather then just the form. Is there anyway to do this. How do we figure out how to stretch the objects. Thanks again.
 

Moppsy,

I think what you mean is this: When the user maximises the form, you want to adjust the sizes of the individual controls so they stay in proportion to the new form size. Is that right?

If you had VFP 9.0, you would use the Anchor property, but that's not available in 6.0. There are several "resizer" classes available, but they don't really do what you want. They blindly change the size of all the controls, without any regard for what type of information the control contains.

The only thing you can do is to write some code that looks at each control in turn, and resizes it in proportion to the change in size of the form. However, it should do so intelligently. For example, if the form doubles in size, you don't want to double the size of your command buttons or labels. You might want to double the width of a text box, but not its height. And so on.

In other words, there is no easy way. You will have to write the code yourself (as far as I know).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
For maximizing a single control, like maybe an edit box, you may be able able to simulate Min/Max buttons using a command button near the control.
Put code in the click event to first save off the name of the control you are zooming as well as the original position values to some form variables, as well as the position of the command button.
You can then either move the command button or make it invisible and zoom the object.
If you move the command button, you will need to have code in it to determine whether you're minimizing or maximizing, so that when you click it again you can restore the values from the form variables and reszie the zoomed object.
If you create a second button for restoring the object to it's original position, you will still restore the values and resize the object, but instead you may want to just make the second button invisible and the first visible.

Also, other objects on the screen will have to be hidden while the control is zoomed or they will shine through.

Here's a sample form. See if it's what you had in mind:
Code:
**************************************************
PUBLIC zoomobj

zoomobj = CREATEOBJECT("zoomobjclass")
zoomobj.Show

DEFINE CLASS zoomobjclass AS form


   Top = 0
   Left = 0
   Height = 348
   Width = 375
   DoCreate = .T.
   Caption = "Form1"
   olastmaxed = .F.
   olastmaxedname = .F.
   olastmaxedtop = .F.
   olastmaxedleft = .F.
   olastmaxedheight = .F.
   olastmaxedwidth = .F.
   czoombutton = .F.
   Name = "Form1"


   ADD OBJECT edit1 AS editbox WITH ;
      Height = 133, ;
      Left = 72, ;
      Top = 36, ;
      Width = 217, ;
      Name = "Edit1"


   ADD OBJECT command1 AS commandbutton WITH ;
      Top = 14, ;
      Left = 266, ;
      Height = 23, ;
      Width = 25, ;
      Caption = "+", ;
      Name = "Command1"


   ADD OBJECT command2 AS commandbutton WITH ;
      Top = 0, ;
      Left = 350, ;
      Height = 20, ;
      Width = 24, ;
      Caption = "-", ;
      Visible = .F., ;
      Name = "Command2"


   PROCEDURE command1.Click
      *...First, save off the old values
      Thisform.oLastMaxedName   = ThisForm.edit1.Name
      Thisform.oLastMaxedTop    = ThisForm.edit1.Top
      Thisform.oLastMaxedLeft   = ThisForm.edit1.Left
      Thisform.oLastMaxedHeight = ThisForm.edit1.Height
      Thisform.oLastMaxedWidth  = ThisForm.edit1.Width

      ThisForm.cZoomButton      = This.Name
      *... zoom
      ThisForm.edit1.Top    = ThisForm.Top    + 20 
      ThisForm.edit1.Left   = ThisForm.Left   
      ThisForm.edit1.Height = ThisForm.Height - 20
      ThisForm.edit1.Width  = ThisForm.Width  - 10
      This.Visible = .F.
      ThisForm.command2.Visible = .T.

      RETURN 
   ENDPROC


   PROCEDURE command2.Click
      *...Restore
      STORE ThisForm.oLastMaxedName TO oCurObj
      WITH ThisForm
         .&oCurObj..Top    = Thisform.oLastMaxedTop
         .&oCurObj..Left   = Thisform.oLastMaxedLeft
         .&oCurObj..Height = Thisform.oLastMaxedHeight
         .&oCurObj..Width  = Thisform.oLastMaxedWidth
      ENDWITH 

      STORE ThisForm.cZoomButton TO cLastButton
      ThisForm.&cLastButton..Visible = .t.
      This.Visible = .F.  

      RETURN 
   ENDPROC


ENDDEFINE
**************************************************

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
You might want to look at
thread184-728913

I have used the referenced Stretchy-Resize control on a number of my forms and it has worked well for my users.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top