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

Code for _mwi_arran

Status
Not open for further replies.

Gotheallblacks

Programmer
Oct 16, 2003
60
NZ
I have a top level form with an Outlook style menu on it set to the left which I don't want covered. I am wanting to have the 'Window' menu bar Arrange child forms of this form inside a specified white space area of this form.

Is there _mwi_arran code availiable ?
 
This might do it, play around with the parameters to suit your neeed.
Code:
DO FORM c:\form1.scx
DO FORM c:\form2.scx
arrangeall('form1',.t.,100,100)
Function arrangeall(tcFormName,tlOmitAutoCenteredForms,;
	tnStartTop, tnStartLeft, tnStartColumn )
#Define WINDOW_STAGGER_FACTOR   Sysmetric(9)
Local lnArranged, lnColumn, lnTop, lnLeft, loFormRef, ;
	lnParentHeight, lnScaleMode, lnIndex, llAllForms
lnScaleMode = _Screen.ScaleMode
_Screen.ScaleMode = 3

lnArranged = 0

lnTop =    Iif(Type("tnStartTop")  = "N", tnStartTop, 0)
lnLeft =   Iif(Type("tnStartLeft") = "N", tnStartLeft,0)
lnColumn = Iif(Type("tnStartColumn") = "N" And tnStartColumn > 0, ;
	tnStartColumn, 1)
lnParentHeight = _Screen.Height
llAllForms = Empty(tcFormName)
For lnIndex = _Screen.FormCount To 1 Step -1
	loFormRef = _Screen.Forms(lnIndex)
	If Upper(loFormRef.BaseClass) == "TOOLBAR"
		Loop
	Endif
	If (llAllForms Or Upper(loFormRef.Name) == Upper(tcFormName)) And ;
			loFormRef.WindowState = 0 And loFormRef.Visible And ;
			(Not (tlOmitAutoCenteredForms And loFormRef.AutoCenter))
		lnArranged = lnArranged + 1
		loFormRef.Top =  lnTop
		loFormRef.Left = (lnLeft * lnColumn)
		loFormRef.AutoCenter = .F.
		lnTop = lnTop + WINDOW_STAGGER_FACTOR
		lnLeft = lnLeft + WINDOW_STAGGER_FACTOR
		If lnTop > lnParentHeight - WINDOW_STAGGER_FACTOR
			Store WINDOW_STAGGER_FACTOR To lnTop, lnLeft
			lnColumn = lnColumn + 1
		Endif
	Else
	Endif
Endfor
_Screen.ScaleMode = lnScaleMode
Return lnArranged



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Gotheallblacks,

Go into the menu designer. Create a "quick menu". Delete all the bars except Window. In View / General Options, set Location to Append. Generate and save the menu (call it WMenu for the sake of example).

In your main program or form Init method, place two calls:

DO MAIN.MPR && launches you main menu
DO WMENU.MPR && launches the Window menu

Not only will have an Arrange command, but the Window menu will also have a bar for each of the child form.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
MikeLewis
Is there _mwi_arran code availiable ?

I read this to mean that the poster wanted to hack (or modify ) the _mwi_arran code, not just use it as is.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I read this to mean that the poster wanted to hack (or modify ) the _mwi_arran code, not just use it as is.

Fair comment. I read it that he wanted to arrange the windows by any convenient method, but if you're right, then your code will do the job nicely.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks Mike. I had this code already from "Solutions" I use it for "Cascading". I'm a bit confused I'm wanting to "Arrange" or "Tile" forms and yes I want to "hack as I want to "Arrange/Tile" child forms in a specified Whitespace area of Parent Form.
I Can't see the above is used for "Arrange/Tile" there has got to be more to it ie calulating no open forms dividing sizes to fit into areas etc ????

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top