[Lazarus] How to draw text in a edit (GTK2)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Oct 4 04:33:53 CEST 2011


silvioprog schrieb:
> Hi,
> 
> In Windows is very easy:
> 
> (...)
> var
>   VCanvas: TControlCanvas;
> begin
>   VCanvas := TControlCanvas.Create;
>   try
>     VCanvas.Control := Edit1;
>     VCanvas.TextOut(0, 0, 'Test');
>   finally
>     VCanvas.Free;
>   end;
> end;
> (...)
> 
> But, this code don't works in Linux (Ubuntu 11.04 / GTK2).

It most probably doesn't work on a Mac, where painting is allowed only 
in during WM_PAINT.

> What the alternative to draw text in a TWinControl (GTK2)?

Invalidate the control, and wait for it's OnPaint request.

DoDi





More information about the Lazarus mailing list