Solved

Showing several TPanels

Posted on 1997-05-06
7
243 Views
Last Modified: 2010-04-06
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... )
0
Comment
Question by:roblam
  • 3
  • 2
  • 2
7 Comments
 
LVL 2

Expert Comment

by:gysbert1
ID: 1335967
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 ?
0
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1335968
You could use Application.ProcessMessages to make the panels redraw faster. You would have to use it everytime you change the page. Let me know if you already tried this.

0
 

Author Comment

by:roblam
ID: 1335969
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...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:javiertb
ID: 1335970
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.

0
 
LVL 2

Expert Comment

by:gysbert1
ID: 1335971
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 :^(
 

0
 
LVL 2

Expert Comment

by:gysbert1
ID: 1335972
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 :^(
 

0
 

Author Comment

by:roblam
ID: 1335973
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...  
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

14 Experts available now in Live!

Get 1:1 Help Now