Difference between revisions of "Win32/64 Interface"

From Lazarus wiki
Jump to navigationJump to search
Line 32: Line 32:
  
 
===TCheckListBox===
 
===TCheckListBox===
 +
 +
See also: [[Windows_CE_Development_Notes#TCheckListBox]]
  
 
* TWin32WSCustomCheckListBox implements some minimal methods
 
* TWin32WSCustomCheckListBox implements some minimal methods

Revision as of 12:35, 8 February 2008

Introduction

The win32/64 interface is arguably the most polished and well developed interface of Lazarus, being also the most used one considering the number of downloads. Despite being the most complete, there are still some problems with it that need fixing.

Another important point about the win32/64 interface is that it is currently undergoing migration to unicode.

Other Interfaces

Platform specific Tips

Interface Development Articles

Current issues

Scrolling

The scrolling is currently done by moving the childs instead of the client area as the LCL expects. For example in some cases it looks as if the childs are scrolled in reverse direction. The truth is that the scrolling is pretty much broken. Scrolling the childs is incompatible to the other widgetsets and has a drawback: Moving one child after the other generates several move messages. The LCL receives the messages and each time it has to react. For example it has to realign all anchored childs. You can control this trouble for one widgetset but it will never work well for all. So this works for Delphi VCL, but not for the LCL. Therefore another approach must be implemented:

Solution

Between child windows and parent window a 'client area' window will be inserted. The child windows are put onto the 'client area' window and when the childs are scrolled the 'client area' window is moved instead. This is already done by the other widgetsets.

Mattias: I will implement this eventually, but my winapi interface knowledge is little and I have a lot of other lazarus tasks already, so I can't say when I implement it.

Related bug reports

Implementation details

This list explains how specific parts of the LCL are implemented on the Win32 interface to help people find the appropriate code in it to do bug fixes.

TCheckListBox

See also: Windows_CE_Development_Notes#TCheckListBox

  • TWin32WSCustomCheckListBox implements some minimal methods
  • TWin32WSCustomListBox implements handle creating and most methods
  • TWin32CheckListBoxStrings is the main TStrings descendent for this class

On Windows, a TCheckListBox is a normal window of the class 'LISTBOX' which has the LBS_OWNERDRAWFIXED style set. When the listbox is created a WM_MEASUREITEM message will be sent, and after a WM_DRAWITEM message will be sent whenever an item needs to be painted. In the handler for this message a message LM_DRAWITEM message will be created.

The LM_DRAWITEM message is then intercepted by TWin32WidgetSet.CallDefaultWndHandler and handled in it's internal function:

procedure DrawCheckListBoxItem(CheckListBox: TCheckListBox; Data: PDrawItemStruct);

And here is the real code to paint the TCheckListBox items.

Note: This is kind of ugly, maybe this code should be moved to the LCL so we have a generic code to paint items in case the widgetset doesn't do it itself.

MSDN Docs about the LISTBOX: