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

WindowState changes by itself ?!

Status
Not open for further replies.

diarmaid

Programmer
Jun 27, 2003
34
0
0
IE

Hi all,

I have a top level form with a WindowState = 2, I want it to fill the Windows screen, whatever its resolution/size.

The formname.load contains contains:
Messagebox(this.WindowState), giving a value of 2 (max)

The formname.init contains the same:
Messagebox(this.WindowState), but giving a value of 0 (normal)

I am just using the messagebox() for diagnostic reasons.

And the form displays in normal state. Other forms work fine with WindowState.

Any idea where to look to find what is causing this?
 
By any chance is the form Layout LockScreen = .T. ???


David W. Grewe Dave
 
LockScreen = .f., thanks for the suggestion. I have gone through every property setting doing a comparision with a form that does behave as expected and can't see the issue.
 
Diarmaid,

You're setting ShowWindow to 2 and WindowState to 2 at design time. You are seeing the form as a top-level window, but are not seeing it maximised. Is that right?

I can't see anything wrong with that. It works OK for me. Either there must be some other code that is executed during the start up process (e.g. in the Init, Activate, the GotFocus of the first control), or my understaning of maximised is different from yours. I am seeing the form at the same size as the physical screen, but with the title bar and the Windows task bar still visible. Is that what you expect to see?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Trying putting:

ThisForm.WindowState

in the Watch window and set a breakpoint on it.

Tamar
 
Tamar's suggestion is the one I would go with. Something somewhere is resetting your Windowstate between where you have that messagebox and the form displaying.

The only other thing that I can think of that would give you the behavior you describe is if the form has it's Maxheight and Maxwidth properties set. This would prevent the window from maximizing to the full size of the screen.

boyd.gif

SweetPotato Software Website
My Blog
 
Thanks to all for suggestions.

The forms init event has a call as follows:

thisform.cmbCompany.SetFocus

When I comment out this all works fine. If I leave it there but comment out all code on the combo box the problem stays. The combo box is the one supplied with VFP.

Anyway, I have a work-around, often these are the best solution :)
Thanks, Diarmaid
 
Diarmaid,

Good to hear you've solved the problem.

It would be interesting to know what happens if you put

THIS.Visible = .T.

at the end of your Init, and put:

thisform.cmbCompany.SetFocus

just after that. If it works, it should give you the maximised form that you want, with the focus set where you want it (but you could more easily set the focus by making sure the combo box is first in tab order).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top