An updated (related) question would be whether there is any way to
remove the flicker in THIS case:

I have a couple of TBitBtn components. Appart from their captions and
glyphs, I actually write some information to the canvasses which are
meant to show up ON TOP of each glyph. A button may or may not contain
info/may or may not currently be enabled ( these buttons represent
actual computer terminals in the real world, and are updated based on
what those terminals store in a database - when somebody logs into a
terminal, the corresponding button should display his info and be
enabled).

The procedures I have for either updating or disabling buttons are
below. A TTimer checks the database every second and then runs either
UpdateBtn or ButtonOff depending on the particular button's current
state.
It all works quite well... (although before adding invalidates to each
procedure it had a tendency to lose the caption) ... except it
flickers something awful.

Since I have no desire to cause massive epilepsy among my users, I
would appreciate some advice here (this is a trickier one.. after all
how do you double buffer a BUTTON ?)

A.J.

Procedure UpdateBtn(Button:TBitBtn;UserName,Time,Status:String);
Begin
 Button.Glyph.Canvas.Clear;
 Button.Glyph.Assign(NewMainForm.Image1.Picture);
 Button.Glyph.Canvas.Font.Size := 18;
 Button.Glyph.Canvas.Font.Name := 'times';
 Button.Glyph.Canvas.Font.Color := ClBlue;
 Button.Glyph.Canvas.TextOut(20,20,'User: '+Username);
 Button.Hint := UserName;
 Button.Glyph.Canvas.TextOut(20,50,'Time: '+Time);
 Button.Glyph.Canvas.TextOut(20,80,'Status: '+Status);
 Button.Invalidate;
End;

Procedure ButtonOff(Button:TbitBtn);
Begin
    Button.Glyph.Canvas.Clear;
    Button.Glyph.Assign(NewMainForm.Image1.Picture);
    Button.Enabled := False;
    Button.Invalidate;;
end;

On 5/28/07, Dave Coventry <[EMAIL PROTECTED]> wrote:
Gustavo,

My problem was caused by the fact that the background for my TImage was
black. When I placed it on a black-coloured panel (I used a TScrollBox
as I want to capture mousewheel events), I found the flicker was more or
less unoticeable.

Gustavo Enrique Jimenez wrote:
>
>
> 2007/5/28, Dave Coventry <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
>
>     Gustavo Enrique Jimenez wrote:
>     >
>     >
>     > There are good tutorials/examples on
>     > http://wiki.lazarus.freepascal.org/Developing_with_Graphics
>     <http://wiki.lazarus.freepascal.org/Developing_with_Graphics>
>     > <http://wiki.lazarus.freepascal.org/Developing_with_Graphics>
>     Gustavo,
>
>     Thank you for your reply.
>
>     But they don't really help.
>
>     Do you draw a line to the Image1.Canvas? or do you draw to
>     Image1.Picture.Bitmap.Canvas as suggested by the wiki? Which seems to
>     make the flickering worse?
>
>     Or do you need to suspend onPaint until you've finished drawing?
>
>     In which case, how do you suspend onPaint?
>
>
>
> I have used the "Create a custom control which draws itself" method,
> and it worked very well !! Try this method.
>
> Gustavo
>
> ps: for the record, Felipe Monteiro help me A LOT in private mails.
> Thanks Felipe, and excuse me for bother you in private.
>
>
>
>
>


--
Dave Coventry
Tel   (home):  +27(0)31 3092301
Tel (office):  +27(0)31 2058448

Cell: +27(0)82 9000179

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives



--
A.J. Venter
CEO - OutKast Solutions C.C.
http://www.outkastsolutions.co.za
Cell: +27 83 455 9978
Fax: +27 21 413 2800
Office: +27 21 591 6766

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to