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

Moving form resets "CenterOwner" or "CenterScreen" during design time 1

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
I am working with Visual Basic 6 pro, in an SDI enviroment, whenever I move the forms around, or any changes to their placement, their StartUpPosition attributes are reset to Manual, I want to be able to lock down their CenterOwner or CenterScreen attribute, I tried making it during runtime before any of the forms are shown to set those attributes to '1', but unfortunatly this attribute can only be changed during design time, any clues? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Karl,<br>&nbsp;&nbsp;&nbsp;That's just the way it works.&nbsp;&nbsp;As soon as you change the top or left property (which you're doing implicitly by moving the form) the StartupPosition property gets reset.&nbsp;&nbsp;Locking the form only locks the controls on the form, not the form itself.<br>&nbsp;&nbsp;&nbsp;&nbsp;This has bothered me too, so I just went back to the old tried and true method of centering the form in the form load event:<br><br>me.move (screen.width - me.width)\2, (screen.height - me.height)\2 <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
unfortunatly at the moment I am using MultiMonitor. would be a little hard to test. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
you can't set this property at run time <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Drone , you didnt read it all, I said why I cant do that, cause i've tried <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Karl,<br><br>Have you considered saving the top and left properties of your forms in the registry?<br><br>On form_load you would say &quot;me.top=getsetting(...&quot;<br><br>And in the *_unload events &quot;savesetting(...&quot;<br><br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Please -- Don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
 
in distributed applications, that isnt exactly a pratical method, I'll probally just end up making sure I set all the forms to that property before building it. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
&quot;in distributed applications, that isnt exactly a pratical method&quot;<br><br>not sure i understand you - why is that? <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Please -- Don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
 
during design time on my computer, the top and left are going to be negative numbers(multiple monitors) also the numerous different screen res people will be using, well saving a set # into the registry entry, wont do, since the person's resolution can be different everytime, and the first time run, is usally going to be the only time run(its a WebSaras instalation folder, installs a Web Application onto their webserver, and sets it up for them) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
There was a clue in the very first message of this thread.
Karl said that he is working &quot;in an SDI enviroment&quot;!
Go and switch the VB design environment from SDI to MDI (Tools -> Options-> Advanced) and the StartUpPosition property will be set just fine!

- XapkoB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top