* * *

Author Topic: How to disable double buffering of TCustomControl with lclgtk2 ?  (Read 2295 times)

sainimu78

  • Full Member
  • ***
  • Posts: 117
Re: How to disable double buffering of TCustomControl with lclgtk2 ?
« Reply #15 on: March 01, 2018, 02:49:52 pm »

Please put a break point at bookmark 1, after hitting the breakpoint, F8 step over, you should see the region is painted, then F9 continue running, you should see the region is ereased.

You could help me replace this with gtk or gdk or x11 ... APIs to paint the region bypassing LCL(Of cause I'm trying do this now too) and this is what I'm not familiar with.

Set result of param Msg of WMPaint to 1 still erease the region
« Last Edit: March 01, 2018, 03:31:23 pm by sainimu78 »

jamie

  • Hero Member
  • *****
  • Posts: 767
Re: How to disable double buffering of TCustomControl with lclgtk2 ?
« Reply #16 on: March 01, 2018, 11:37:45 pm »
Try overriding the WM_ERASEBKGND or LM_ERASEBKGND message in your control.

employ a message handler for that message and set the return value as 1, that indicates that
it has been processed and should no longer get processed.

 Unless there is something different about how this is done over the Windows widget It should
work for you.

sainimu78

  • Full Member
  • ***
  • Posts: 117
Re: How to disable double buffering of TCustomControl with lclgtk2 ?
« Reply #17 on: March 02, 2018, 01:54:23 am »
Try overriding the WM_ERASEBKGND or LM_ERASEBKGND message in your control.

employ a message handler for that message and set the return value as 1, that indicates that
it has been processed and should no longer get processed.

 Unless there is something different about how this is done over the Windows widget It should
work for you.
Maybe it is and I tried.
I think I get a wrong handle to do custom paint.
Code: Pascal  [Select]
  1.   pW := PGtkWidget(Handle);
  2.   pDW := pW^.window;// gtk_widget_get_window(pW);
  3.   if(pDW = nil)then
  4.     Exit;
  5.   if(fGC <> nil)then
  6.     Exit;
  7.   fWindow := gdk_x11_drawable_get_xid(pDW);
  8.   fDisplay := gdk_x11_drawable_get_xdisplay(pDW);
  9.   //if(fGC <> nil)then
  10.   //  XFreeGC(fDisplay, fGC);
  11.   fGC := XCreateGC(fDisplay, fWindow, 0, nil);
  12.   XGetWindowAttributes(fDisplay, fWindow, @attrs);
  13.  
  14.   w := attrs.width;
  15.   h := attrs.height;

The w and h seems the w and h of the whole form, it is wrong, how to get the correct fGC with lclgtk2 ?

Code: Pascal  [Select]
  1.   pW := PGtkWidget(Handle);
  2.   pDW := pW^.window;// gtk_widget_get_window(pW);
Is pDW here equvalent to HWND on windows ? I can do custom paint a TCustomControl using windows native api on windows, I think I just get a wrong pDW and I don't know how to. Give me a hand.
« Last Edit: March 02, 2018, 02:02:00 am by sainimu78 »

jamie

  • Hero Member
  • *****
  • Posts: 767
Re: How to disable double buffering of TCustomControl with lclgtk2 ?
« Reply #18 on: March 02, 2018, 03:45:10 am »
I assume you are using standards classes here.?

Are you using TWincontrol somewhere in the base

override the
 
Procedure WMEraseBKGnd(); Message;
« Last Edit: March 02, 2018, 03:52:34 am by jamie »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus