Recent

Author Topic: How Write ListBox - TLMDrawListItem  (Read 350 times)

J-23

  • Jr. Member
  • **
  • Posts: 94
How Write ListBox - TLMDrawListItem
« on: May 12, 2020, 11:11:57 pm »
Hello,

trying to find out how ListBox was written. I mean this fragment how he knows it has done

Code: Pascal  [Select][+][-]
  1. procedure TCustomListBox.LMDrawListItem(var TheMessage: TLMDrawListItem);
  2.  

after adding item. I am asking because I cannot find this part which is responsible for it.

korba812

  • Full Member
  • ***
  • Posts: 134
Re: How Write ListBox - TLMDrawListItem
« Reply #1 on: May 12, 2020, 11:42:04 pm »
Keep in mind that LCL encapsulates native widgetset so most of operation is done by widgetset internally and is platform dependent (e.g. message notification on win32, handlers on gtk, etc ...).
I recommend studying LCL interfaces source (lcl\interfaces directory), e.g. lcl\interfaces\win32\win32callback.inc or lcl\interfaces\gtk2\gtk2listsl.inc

J-23

  • Jr. Member
  • **
  • Posts: 94
Re: How Write ListBox - TLMDrawListItem
« Reply #2 on: May 13, 2020, 12:19:47 am »
thank for help

jamie

  • Hero Member
  • *****
  • Posts: 3526
Re: How Write ListBox - TLMDrawListItem
« Reply #3 on: May 13, 2020, 12:45:00 am »
For ownerDraw list boxes in WINDOWS, the Window receives a WM_DRAWITEM but this takes place in the widget set level. It then gets translated into a Lazarus message to be used in the LCL code.

  Each widget has it's own way of handling this activity but to keep it compatible for the common part of the code it gets translated into a single function or Message so that only one code base is needed.

  If you were doing WINDOWS only in other tools you would process the WM_DRAWITEM message, and if you were doing this in lets say Linux it would be a totally different story..

 So to keep things even with all targets the Widgets were born. Just think of them as Translators or proxies.

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018