gtk2: tControl.Onpaint Message missing lazarus / 39-Graphics ---------------------------------------------------------------------- Martin V · 2016-08-22 09:32 In gtk2 (Linux), Controls do not have an OnPaint message, an overwritten Paint message is not executed. Only tForm.OnPaint/Paint exists and is executed. I have got a Form where a Control resides in. I want to redraw only a part of my Control. (The Control is an editor and fills nearly the whole Form). But with InvalidateRect I can only make a repaint of the whole Form and if the control is part of the invalidated Rectangle, the whole Control gets painted. In Windows, I can send an InvalidateRect (Control.Handle...) How to redraw a part of a control on the Linux platform without having a Control.Paint ? Setting Control.Fillrect before using InvalidateRect (Form.Handle) has no effect. Redrawing outside the Paint message works, but this would not work on MacOS, because MacOS only allows drawing within a Paint message. A sample is nearby. If the control gets white, the whole control has been repainted I do not want. ---------------------------------------------------------------------- JuhaManninen · 2016-08-22 14:42 May be difficult with TPanel. Try instead TPaintBox or some other control which is not derived from TWinControl. ---------------------------------------------------------------------- Martin V · 2016-08-22 16:46 My original control is derived from tCustomControl which contains the OnPaint, the Handle and the KeyPress property which I need for my editor. Now I have replaced the tPanel in the sample with a CustomControl and use InvalidateRect (CustomControl.Handle, ...), see attachment. But it still does not work and repaints the whole control after using InvalidateRect. Is this a bug? P.S.  Paintbox does not work because it has an OnPaint event, but no handle. ---------------------------------------------------------------------- JuhaManninen · 2016-08-22 16:56 Quote from: Martin V on August 22, 2016, 06:46:53 pmP.S.  Paintbox does not work because it has an OnPaint event, but no handle. My idea was that you paint what you need in OnPaint handler and do not call InvalidateRect. I don't know why you need it. However my knowledge of graphics programming is not very good. Somebody else can answer better. ---------------------------------------------------------------------- Martin V · 2016-08-22 19:44 My control is a complete text editor which can fit the whole screen. The editor should only redraw the part where the user types input or where the text cursor blinks and so on. At the moment, the Linux version uses direct drawing outside the OnPaint message and it works. On Windows, both codes work (direct drawing and drawing inside OnPaint), and on MacOS only drawing inside OnPaint is allowed. All works fine at the moment, but only with different code. On the long run, I hope that one single code works (write once, compile everywhere) and I want to report lcl bugs after I'm sure. If anyone is interested in my work: http://www.hypermake.com/english/betatest.html http://www.hypermake.de/deutsch/betatest.html