Solved

Conditional Creation of Visual Components

Posted on 2002-07-16
5
159 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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