Solved

Showing several TPanels

Posted on 1997-05-06
7
244 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 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