Author Topic: custom draw method on gtk2  (Read 3935 times)


  • Sr. Member
  • ****
  • Posts: 393
custom draw method on gtk2
« on: August 11, 2006, 02:27:53 pm »
I've made a class derived from TCustomListBox and override the Paint() method. It worked great on win32 and gtk1 (linux), but failed on gtk2 (linux). It seems that gtk2's LCL is not allowing custom drawing routine. Is it correct or it's just my fault? This'd be my first problem with gtk2.

The second is... I have another class derived from TPaintBox. The primitives shapes drawing worked great on all environment (win32, gtk1, gtk2). But, for text drawing routines (e.g. function Canvas.TextOut()) only work fine on win32 and gtk1. On gtk2, the text drawing routines seem to have errors on text position calculation. For example, Canvas.TextOut('test',0,0) should be on the most left and most top of the associated canvas (like on win32 and gtk1), instead it's drawn on different position. The text coordinate origin on gtk2 seems to be on parent's Left property value for the X coordinate and parent's Top property value for the Y coordinate.

I'm asking these just to make sure they're not bugs. If indeed they're bugs, then I'll report them on mantis. If they're bugs and there's someone can give me hints where (and how) to fix them, I'd like to help to fix them and send the patches. I'm sorry, but the Lazarus source codes are too complicated for me to hunt the bugs. :)

FYI... I'm using Lazarus 0.9.16 on winXP SP2 (for win32 environment) and linux SuSE 10.1 (for gtk1 and gtk2 environment).

Any hints? TIA.


PS: Sorry for my bad english. Hope you could understand what I meant. :)

A long time pascal lover.


  • Newbie
  • Posts: 1
RE: custom draw method on gtk2
« Reply #1 on: August 12, 2006, 10:04:21 am »
for what I could see about textout on gtk2, it just doesn't work in many cases. ie in ttreeview, nothing appears in the treeview but images. One way to correct the problem is to use textrect instead of textout. At least it worked for me to get the treeview text to be displayed.


TinyPortal © 2005-2018