Solved

Conditional Creation of Visual Components

Posted on 2002-07-16
5
156 Views
Last Modified: 2010-04-04
Hello,
I have this situation.
A form in which Activate event, depending on some configuration, a panel that contains some controls is hiding, making it invisible.
The panel is align OnTop, so i need to resize the form, recenter it in the screen.
That works ok, and you see a little blinking. But, when you run the proyect in slow machines, you see a large movement in the screen.
Here is the question...
Can i do all the task at the OnCreate event?
I had trouble by resizing the form at that level, and the configuration variable cannot be read if it belongs to the form unit.
Thanks you all...
0
Comment
Question by:spk2000ar
5 Comments
 
LVL 7

Expert Comment

by:Cynna
ID: 7156786
I'm not sure I got you right, but you might try
moving your code to OnFormShow event.
If that yields better results, just use flag (for example, global var AlreadyShowed) to prevent your code from executing whenever the form is showed...
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7156793
Alos try setting Form.DoubleBuffered to True.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7156806
>Can i do all the task at the OnCreate event?
should work,
can you show your tries?
0
 

Accepted Solution

by:
RayNorrish earned 50 total points
ID: 7178664
To stop "flicker" when altering a window try:

   LockWindowUpdate(Self.Handle);

 // do your resize/recentre

   LockWindowUpdate(0);

This will stop any repainting of the form while you move stuff around.

Of course .. the "flicker" on a slow machine could be down to a poor graphics adapter as well.

I also agree to move the code to the onShow event, as your other components may not be created / available in the form's onCreate event.
0
 
LVL 4

Author Comment

by:spk2000ar
ID: 7181262
Sorry about the delay...
I will accept RayNorrish answer because is the most accuratte.
But, Cynna, please i will send another question to adjust points (25) to give you that answer... answer it, for me to accept it.
Thanks you all...
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now