Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto Centering of Container on Form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01622935
Message ID:
01622941
Vues:
42
>>>>Hi Gang!
>>>>
>>>>Thanks for your help on previous problems!
>>>>
>>>>Today, I have this one.....
>>>>
>>>>I have a FoxPro form that is popped up on the screen when a certain amount of inactivity occurs.
>>>>
>>>>It pops up MAXIMIZED now with the WindowState property set to Maximized.
>>>>
>>>>I set it to that to HIDE what is behind the form so any user passing by could not see HIPPA data displayed on the screen.
>>>>
>>>>There is also a container on the form which has input textboxes for the user to type in the login name and password to get rid of the form and resume work.
>>>>
>>>>The container stays near the left and top of the form, no matter the size of the form ( some have 800 by 600 and some have all the way up to 1920 by 1080).
>>>>
>>>>I'd like for the container ( name is cntLocked ) on the form to stay CENTERED top to bottom and left to right, no matter the screen size.
>>>>
>>>>I tried adding this to the forms RESIZE event, but it had no effect....
>>>>
>>>>
>>>>Thisform.cntLocked.Left = INT((Thisform.Width 	- Thisform.cntLocked.Width) /2)
>>>>Thisform.cntLocked.Top  = INT((Thisform.Height   - Thisform.cntLocked.Height) /2)
>>>>Thisform.Refresh
>>>>
>>>>
>>>>Any ideas?
>>>>
>>>>Will I have to do a BindEvent ?
>>>>
>>>>Thanks!
>>>
>>>OOPs,
>>>After I posted my answer I saw that I'm not right.
>>>
>>>What is wrong with that code?
>>>It works fine in my form resize event.
>>>
>>>Maybe Anchor is set for the container?
>>
>>I rechecked the Anchor... it is set to 0 for the container.
>>
>>I will keep checking.
>>
>>Maybe I need to call the Resize Event form the Init of the form ?
>
>No, just center the container in Development mode.

I tried that to, but it stayed put in the form.

It appears the Resize event of the form does not fire on its own in this situation.

So, I added a timer to the form that fires 100 milliseconds after the form has Inited.

The code above is added to the Timer event, plus I turn the timer OFF at the beginning of the timer event so it only fires 1 time. ( Plus I make the container invisible at first, then visible at the end of the time event..... to eliminate 'flicker').

This worked!

Thanks!!!
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform