BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: How to position a form on screen at runtime?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
JD
Guest





PostPosted: Wed Jul 30, 2003 8:04 am    Post subject: Re: How to position a form on screen at runtime? Reply with quote




"Rainer Könnecke" <r.koennecke (AT) ist-net (DOT) de> wrote:
Quote:
[...] Just writing Left=24; Top=12; in the contructor does
not lead to the wished result

It should.

Quote:
(same applies to OnCreate and OnShow)

Never ever ever use the OnCreate / OnDestroy events. They are
Delphi remnants that can execute before the Constructor / Destructor
which is illegal in C++.


Quote:
I could manage to use OnActivate but then there is a flicker
since the form appears at its design-time position and then
it is moved to the new position!

This tells me that the assignment is working. You must be
overriding the assignments in the Constructor somewhere.

Quote:
The form is derived from a base form which itself is based on TForm.

That should make no difference. It's somewhere in your code.

~ JD


Back to top
Jonathan Arnold
Guest





PostPosted: Wed Jul 30, 2003 12:19 pm    Post subject: Re: How to position a form on screen at runtime? Reply with quote



Rainer Könnecke wrote:
Quote:
What do I have to obey to correctly position my form on the screen at at
certain location which is determined at runtime?
Just writing Left=24; Top=12; in the contructor does not lead to the wished
result (same applies to OnCreate and OnShow)

As mentioned - do not *ever* use OnCreate/OnDestroy. They are lingering
Delphi-isms that should be avoided at all costs. See:

http://www.bcbdev.com/articles/suggest.htm#oncreate

Otherwise, setting Top/Left in the constructor works fine, *if* you have
the Position property of the form set correctly. Most of the options work,
but some, like DesktopCenter, will override your changes and reposition
your form. Set it to poDesigned and you should be fine.

--
Jonathan Arnold C/C++/CBuilder Keen Advice:
http://www.keen.com/categories/categorylist_expand.asp?sid=5156620
Comprehensive C++Builder link site:
http://www.buddydog.org/C++Builder/c++builder.html



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.