Paul,
This should help you out.

http://www.news2news.com/vfp/?example=78&function=137

It is a fairly easy exercise to add an object that returns the dimensions of
an activewindow given the window handle. In the demo I provide the handle
for the Dialog box so you should be able to use the code above to extract
the size etc and modify the row, column parameters accordingly.

If you have a problem then I'll take a look tonight as I'm a little busy at
the moment.

I have an object class "clsWindowDimensions" which used the above code as a
basis but I can't lay my hands on it at the moment. Still, that should keep
you busy for a couple of hours anyway!

Dave Crozier


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Newton
Sent: 27 March 2008 11:14
To: [email protected]
Subject: Re: GETFILE() window location

Dave

This looks terrific - many thanks.

All I need now is a way to get the size (width and height) of the dialog
window so that I can compute where it should go in order to be centred ...

No doubt you have left that as "an exercise for the reader" !

Paul

----- Original Message -----
From: "Dave Crozier" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: 27 March 2008 09:48:12 o'clock (GMT) Europe/London
Subject: RE: GETFILE() window location

Paul and others,

I solved the problem of moving the Getfile() dialog box under program
control from VFP and thought that it would be a good exercise to produce a
wrapper that can call any Windows Dialog  e.g GetPrinter, GetDir() etc. and
position it on the screen at a particular place as opposed to wherever
Windows deems suitable.

The problem of dealing with the GetFile() and also the Putfile() dialog was
definitely non trivial as these dialogs seems to instantiate in a completely
different way to the "easy one" GetPrinter() which I posted sample code to
reposition earlier this week.

Anyway, the code/class/wrapper is available for everyone to look at and
maybe improve upon at:

www.replacement-Software.co.uk/vfp/VFP_Dialog_Mover.zip

There is one problem to do with destroying the object used to control the
dialogs which I have put a note about in the demo program. If you are going
to take a look at the software, download the project and run the init() file
first then the demo program and look at the notes to see the "problem" and
how it manifests itself.
 
I'll post a writeup of the method I endedup using to control the dialogs on
my Blog later this week as I ended up writing and using a "non destructible
timer" in VFP that is not affected by things like Modal windows being
displayed. The class also uses some neat API calls for those of you who like
those sort of things.

This "unstoppable" timer will be very useful in a lot of the projects that I
work on involving Comms as modal windows really do screw up VFP timers no
end. Anyhow that is a different story and future blogging article
completely.

Hope the demo and class is useful to some of you out there.

Dave Crozier


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Newton
Sent: 26 March 2008 16:12
To: [email protected]
Subject: Re: GETFILE() window location

Many thanks Dave - much appreciated

Paul

----- Original Message -----
From: "Dave Crozier" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: 26 March 2008 16:16:00 o'clock (GMT) Europe/London
Subject: RE: GETFILE() window location

Paul,
I've just tried it with Getfile() and the Getfile() window handles itself in
a different way to the Getprinter() window and seems to be "Really modal" as
opposed to the Getprinter() window which allws VFP to process in the
background. The result is that the timer never gets to fire as the window is
instantiated before the timer event and seems to block everything else. 

I'll give it another look later on to see if I can come up with a fix.

Dave Crozier


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Newton
Sent: 26 March 2008 13:28
To: profox
Subject: GETFILE() window location

Hi all

Tristan first posed this question a couple of years ago:

Is there a way to tell VFP where to display the window when issuing a
GETFILE()?

And Dave C suggested:

How about wrapping the getfile() up with a timer in the background which
picks up the window handle via API calls and then repositions it according
to your wishes. Somewhere I have an example of this approach using the
Getprinter() dialogue so I know it works and yes the timer still fires even
thought the Getprinter() dialogue is modal.

I'll try and dig it out tonight.

He even said:

I did but its at home at the moment so I'll post it on the list tonight.

Trouble is I can find no trace of this - do you still have it (Dave) ?  Or
Tristan ?

Thanks

Paul Newton



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to