?
Solved

Showing several TPanels

Posted on 1997-05-06
7
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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