Solved

Showing several TPanels

Posted on 1997-05-06
7
242 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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