Link to home
Start Free TrialLog in
Avatar of roblam
roblam

asked on

Showing several TPanels

I have an application with a TPageControl. Within this TPageControl are 3 TTabSheet, and within thes TTabSheet are several TPanel. My problem is that when I switch between TTabSheet, the TPanels redraw themselves, and they apear slowly  one by one on the screen. Is there a way I can make them appear all at once, thus making the process faster?

(I'm sorry if my english is'nt very good, I don't write in english very often... )
Avatar of gysbert1
gysbert1

Do you really need panels, Couldn't you use bevel's instead ?

Since Panels are all windowed controls they take time to bring up since the window has to be registered, etc. if it is created.

Windows are managed differently from normal graphics and thus they take longer to draw even if they are already created and they just need to be shown.

In most cases you can get away using bevels.

If someone out there can correct me I would be happy though. I used to have a few (12) Panels on a page that had to be moved frequently and I never could get them to do it quickly.

mheacock ? Sperling ? javiertb ?
ASKER CERTIFIED SOLUTION
Avatar of javiertb
javiertb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of roblam

ASKER

I already tried it, but it doesn't change a thing... I will try the method described by gysbert1, and I'll let you know if it worked...
I think it's something similar, but you could try this and tell me if it works:
LockWindowUpdate(MyForm.Handle);  
// Do whatever
LockWindowUpdate(0);  <-- This makes all the changes to be painted at once.

I have tried every possible trick to try and get the panels to draw faster. I used ProcessMessage, I used LockWindowUpdate, ect.
I even drew everything on the panel before caling TPanel.show because I thought it redraws for every object added to it, no luck.

Eventually I decided that the reason was not because of the redraw, remember it works fine with bevels which should be the same as panels which are forced to update all at once. It must be because the panels are windowed controls for which windows has a lot of control functions as I said in my answer ...

roblam, you really should check the answers before accepting them ! Only because I commented originally do I respond now but you have lost the interest of all the other experts in the process and you still haven't solved your problem :^(
 

I have tried every possible trick to try and get the panels to draw faster. I used ProcessMessage, I used LockWindowUpdate, ect.
I even drew everything on the panel before caling TPanel.show because I thought it redraws for every object added to it, no luck.

Eventually I decided that the reason was not because of the redraw, remember it works fine with bevels which should be the same as panels which are forced to update all at once. It must be because the panels are windowed controls for which windows has a lot of control functions as I said in my answer ...

roblam, you really should check the answers before accepting them ! Only because I commented originally do I respond now but you have lost the interest of all the other experts in the process and you still haven't solved your problem :^(
 

Avatar of roblam

ASKER

I changed all the TPanels I could for Bevels, and I put the line           LockWindowUpdate(MyForm.Handle)

 in the OnChanging event of my TPageControl, and the Line      
     LockWindowUpdate(0);

at the end of my OnChange event. The process is now about 50% faster, enough for my purposes anyway.

To gysbert1: I think you're rigth... Maybe I was a little too impatient...