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!

form positioning on desktop v/s notebook screens 1

Status
Not open for further replies.

arielap

Technical User
Aug 2, 2003
71
GB
part of this app includes forms that pop up on top of a base form which displays patient details in its top third and options below that. That form is centred.

The popup forms should each display covering the lower options part of the base form, leaving the patient data visible above.

I mostly develop on a notebook, and the forms appear as intended there, but when the app is run on a desktop (also LCD screen) their position is way out. Notebook and desktop screens are run at the same resolution(1024x768).

The users also need to run the app from both desktop and notebook. Do I have to provide separate versions for each hardware or is there a way of retaining the same relative positions of popup forms to base, regardless of hardware changes?
 
In my applications I have a table with fields named (cNname, nTop, nLeft, nWidth, nHeigth,....etc)
In the Load statement of the form I open the table and read the values from the table into the form's properties. In the destroy method, I place the values from the form into the table.
This way the form appears on the screen the last place the users put it.
Maybe you can alter this and use it for your situation.

David W. Grewe Dave
 
Hi Dave,

one way of altering it would be to change your field names according to the real form property names and then use

Code:
* record->form
scatter name thisform additive

* form->record
gather name thisform
 
Arielap,

You certainly won't have to create different versions of your app for desktop and laptop PCs. VFP gives you complete control over the positioning of forms on the screen, and it's only a matter of getting the code right.

Perhaps you could post the code to show how you do this at present. Also, are you running in the VFP development environment on both machines, or do you see this behaviour when running from an executable? (The reason I ask is that there might be a VFP setting which is causing the behaviour.)

In general, when calculating screen-related settings, you have to take into account the screen size, the size of the main VFP window, and whether there are any other objects open that might affect the size, such as docked toolbars.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Olaf,
I fight that battle every time I make a new database/table.
I hate using field names that are reserved words.
I keep wanting to, But Standards are standards and I keep not doing it.


David W. Grewe Dave
 
>> It's only a matter of getting the code right.<<
Thanks Mike, that's cheered me up - .

>>Perhaps you could post the code <<
The forms are all created in the form designer.
When that section is run, a patient id is selected from a stand-alone file (recips) and their id details displayed in the upper part of the base form.

Clicking one of the options displayed in the lower part of the base form simply selects all records for that patient from the relevant file 2 (eg cyto) and displays the wanted fields in a grid in a subform. The subform should cover the lower part of the base form, leaving the patient id visible above it. It is these subforms that 'wander', but otherwise they all function (add/print/cancel/return etc buttons) as intended.

>> are you running in the VFP development environment on both machines, or do you see this behaviour when running from an executable?<<

Both (me)- and yes. The problem is the same whether in development or running a complied standalone EXE.
A subform that appears in its correct place on a notebook screen is displaced when the same code is run on an LCD desktop

The users only have a standalone .EXE and do not have VFP installed and have the same problem.
 
Arielap,

So, do you have any code anwhere that explicitly sets the subform's Left and Top properties?

If not, then each time you open the form, it will be positioned according to the settings at design time, which is presumably not what you want. (Although that wouldn't explain why it was different on the two machines.)

I suggest you try something like the following. When you create the subform, pass an object reference to the calling form. For example:

* Calling form
DO Subform WITH Thisform

* Init of the subform
LPARAMETERS toCaller

Then, in the subform, set the Top and Left according to the position and size of the caller:

* In Init of subform
Thisform.Left = toCaller.Left + 10
&& subform will be slightly to right of main form

Thisform.Top = toCaller.Top + (toCaller.Height / 3)
&& subform will be one third of way down main form

Also, make sure the subform's AutoCenter property is .F.

Perhaps you could give this a try and report back.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
>>any code anwhere that explicitly sets the subform's Left and Top properties<<

Yes. Left and top settings that position the subforms correctly when that app is run on a notebook, but puts them offset by approx -25% and -33% when the .EXE is run on a desktop.

Incidentally, the app runs full-screen - would this affect things?

>>give this a try and report back<<
Will do - tvm.

 
If resolution is different on notebook and desktop that influences the position. Not th3e absolute one, but if the main form resizes to full screen and the subform opens at the same coordinates it's position relative to the main form does change...

Bye, Olaf.
 
Resolution is nominally the same (everything under my control is,afaik) and the program (of which the problem section is only a small part)starts full screen.

I think I may have the answer, thanks to Mike. Will experiment over the w/end & report back here.
 
>>Perhaps you could give this a try and report back.

Yes - many thanks. Now working as intended.

** the base form /object is hlamenu
and I now have the following in the INIT of the subforms

this.Top=.top+(hlamenu.height*0.25)
this.left=hlamenu.left&&+(hlamenu.left*0.1)

and the subforms now appear correctly positioned on both notebook and desktop screens
 
Use SYSMETRIC command to determine screen resolution and size, format your forms accordingly.

?SYSMETRIC(1),SYSMETRIC(2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top