mshfGrid re-sizing

Carrie
04-07-2003, 03:59 AM
I have an MSHFGrid which opens on my main(first child form loaded) form in my MDI app. I calculate the column widths proportionally depeding on the form size and this works fine except for when I set the MDIMainForm to open maximised.

I am calculating the widths in an 'Initgrid' procedure which is run from the child form load event and the child form resize event.

I have used the debugger and it appears to go through the child form resize code when loading, but the columns haven't been resized when the main form is loaded maximised.

They resize OK when you change the size, but I need them to open correctly if the main form is maximised. Hope someone can help!

Flyguy
04-07-2003, 06:22 AM
What code do you have in the resize event?

Carrie
04-07-2003, 08:46 AM
I run a procedure called Initgrid which does the following:

With mshfSearch

Carrie
04-07-2003, 08:50 AM
With mshfSearch
For iCol = 0 to .Cols - 1
.Colwidth(iCol) = .Width * (colw(iCol)/ 100) ' proportion widths
Next
.Refresh
End with

colw contains percentage widths of all columns
iCol is current col number

It doesn't work when form is first opended - sorry about previous reply hit wrong key

Flyguy
04-07-2003, 04:24 PM
Do you also update the array colw with the new values?

Carrie
04-09-2003, 05:39 AM
Yes I do - the only time it now doesn't work is when I set my MDIMAinform to windowstate = maximise - I iniitialise my grid on form load and form resize, but when it opens maximised the widths are all wrong until I resize the form.

Flyguy
04-09-2003, 06:20 AM
Do you anywhere in your program check the .WindowState?

Carrie
04-09-2003, 07:46 AM
No I don't

Flyguy
04-09-2003, 08:20 AM
Did some testing myself.
When you resize the MDIParent then Resize event of the Child is called before the Resize event of the MDIParent.

What you can do is call the Child resize event from the MDIParent resize event.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum