🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4183

Re: Application ProcessMessages

#4183
From: Remy Lebeau (TeamB)
Date: Mon, 13 Mar 2006 22:14
64 lines
2921 bytes
"saravanan" <asaravanan@ften.com> wrote in message
news:441516f5$1@newsgroups.borland.com...

>   Consider i have 5 windows in my application and only 3 of
> them requires painting, in this case i will try to paint all the 5
windows.

Then you need to selectively choose which forms to repaint, instead of
repainting all of them unconditionally.  If you only have 5, then hard-code
the pointers instead of using a loop:.

    void __fastcall UpdateAppropriateForms()
    {
        Form1->Update();
        Form3->Update();
        Form5->Update();
    }

    void __fastcall TForm1::Function()
    {
        Operation1();
        UpdateAppropriateForms();

        Operation2();
        UpdateAppropriateForms();

        Operation3();
        UpdateAppropriateForms();
    }


Otherwise, you'll have to set up some kind of list that the loop can use to
decide which forms to repaint, ie:

    void __fastcall UpdateForms(TForm **Forms, int FormCountHigh)
    {
        for(int i = 0; i <= FormCountHigh; ++i)
            Forms[i]->Update();
    }

    void __fastcall TForm1::Function()
    {
        Operation1();
        UpdateForms( OPENARRAY(TForm, (Form1, Form3, Form5)) );

        Operation2();
        UpdateForms( OPENARRAY(TForm, (Form2, Form4)) );

        Operation3();
        UpdateForms(OPENARRAY(TForm, (Form1)) );
    }


> Already OS is taking care of painting the necessary area only, i think
> we are ignoring that optimization or performance.

Not true.  Update() only repaints the areas that actually need repainting,
in other words the areas that have pending WM_PAINT and related messages
already in the message queue.  Repaint() on the other hand, is a full
repainting regardless of the current queue status.


Gambit
Technical Details
Message-ID: <4415eebd$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <440ee66c@newsgroups.borland.com> <440f21ca$1@newsgroups.borland.com> <441004a5$1@newsgroups.borland.com> <44109fc6$1@newsgroups.borland.com> <441117a4$1@newsgroups.borland.com> <4411d170$1@newsgroups.borland.com> <441516f5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bb5b2339083fb22b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <440ee66c@newsgroups.borland.com> <440f21ca$1@newsgroups.borland.com> <441004a5$1@newsgroups.borland.com> <44109fc6$1@newsgroups.borland.com> <441117a4$1@newsgroups.borland.com> <4411d170$1@newsgroups.borland.com> <441516f5$1@newsgroups.borland.com>
Subject: Re: Application ProcessMessages
Date: Mon, 13 Mar 2006 14:14:11 -0800
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <4415eebd$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1142288061 68.69.17.41 (13 Mar 2006 14:14:21 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail