I don't know the why but it looks like if you create a Top-level form and run it before you launch these other three forms, the problem goes away. There must be a problem with the Desktop property set to .T. and the _Screen.Forms[] order. When _Screen is not in the picture (i.e. you are using a top-level form), then things get back to normal.
Hope you can use this.
>That was the first thing I thought, so I did the test using just the base VFP form class and button. The only code I added was in the click event of each button.
>
>I added an additonal button to form2 with this in the click event:
>
>acti scree
>? 'thisform = ' + thisform.name
>? 'Active Form = ' + _screen.activeform.name
>? 'Form order:'
>FOR EACH loForm IN _Screen.Forms
> ?loForm.Name
>ENDFOR
>When clicked it displays:
>
>thisform = TEST2
>Active Form = TEST2
>Form order:
>TEST2
>test1
>
>If I move Form2 by grabbing the title bar and dragging it, Form2 will come back on top of Form1.
>
>This is wierd?
>
>>Do have anything going on in the background that could change the order in _Screen.Forms[]. If you have code that runs as part of a non-active form and refreshes that form, for example, this may move that form up in the order. I have had this and I wrapped the refresh in a check to see if it was equal to the _Screen.ActiveForm. If it wasn't, nothing got refreshed.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao