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.
Roi
'MCP' Visual FoxPro
In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!