Recent

Author Topic: [SOLVED]synedit SynCompletion onpaintitem question  (Read 1884 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
[SOLVED]synedit SynCompletion onpaintitem question
« on: November 03, 2017, 06:48:45 pm »
Hi,
I am using the Syncompletion component and I want to paint the item text with an icon and sometimes it works and then sometimes the component writes the text over my custom painted text.
Code: Pascal  [Select][+][-]
  1.      //paint the icon
  2.      main_datamod.main_tool_bar_images.Draw(aCanvas, x+2, y,iconindex) ;
  3.      //write the text past the icon, stype is a string that contains the type of sql i.e. TABLE,VIEW etc.
  4.      acanvas.TextOut(x+20,y, stype);
  5.      acanvas.Font.Style:=[fsBold];
  6.      acanvas.TextOut(x+200,y,Akey);
  7.  

it's like it should have an ownerdraw property or something, probably I am doing it completely wrong LOL.
See the attached image for what it looks like, when execute the completion.


« Last Edit: November 08, 2017, 04:37:58 pm by snorkel »
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: synedit SynCompletion onpaintitem question
« Reply #1 on: November 03, 2017, 07:03:49 pm »
if I change the brush  style to bsclear it looks a bit different, see attached image.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: synedit SynCompletion onpaintitem question
« Reply #2 on: November 03, 2017, 07:51:15 pm »
Nevermind, solved my own issue.

I didn't know that the onpaintevent is actually a function and to fully override the default onpaint, you need to set the result of the event to True.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

 

TinyPortal © 2005-2018