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

Positioning a form 1

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I'm trying to position a form in the corner of my screen when opened. I have tried to use the following code but am getting nowhere with it:

method open(var eventInfo Event)

var
pos Form
endvar

pos.setPosition ("Nested Parts.fsl", winStyleDefault, 100, 100, winDefaultCoordinate, winDefaultCoordinate)

endMethod

Has anyone got any ideas of either where I'm going wrong or maybe an alternative way around the default centre position of a form?

Thanks in advance,

Woody
 
Woody,

Consider these alternatives:

Code:
var
   pos Form
   x, y, w, h LongInt
endVar

   pos.attach()  ; associate with current form
   pos.getPosition( x, y, w, h )
   pos.setPosition( x + 100, y + 100, w, h )

Keep in mind that both getPosition and setPosition deal with twips, as opposed to pixels or points. ObjectPAL provides conversion functions, if you need them.

As far as positioning the form, I suppose the best answer depends on where you want it. Here's one way to open the form in the upper left corner of the Paradox desktop:

Code:
method pushButton(var eventInfo Event)
var
   frm  Form
   foi  FormOpenInfo
endVAr

   foi.name = ":work:custform"
   foi.x = 0
   foi.y = 0
   frm.open( foi )

endMethod

For more information, please see the Help topic for the open() method of the Form type.

Hope this helps...

-- Lance


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top