Combobox with csOwnerDrawFixed style does not work in DLL library under Windows
Original Reporter info from Mantis: zgabrovski
-
Reporter name: Zdravko Gabrovski
Original Reporter info from Mantis: zgabrovski
- Reporter name: Zdravko Gabrovski
Description:
The following code in OnDrawItemEvent does not work when the combobox is placed on the form in DLL library under Windows LCL.
The same works fine in the host application and under Ubuntu gtk2 library.
Please, find pictures and sample project attached.
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
var
S: String;
i: Integer;
begin
with TCombobox(Control) do begin
if odSelected in State then
Canvas.Brush.Color := clHighLight
else
Canvas.Brush.Color:=clWindow;
Canvas.FillRect(aRect);
Canvas.TextRect(aRect, aRect.Left + 17, aRect.Top+ 3, Items[Index]);
aRect.Right := aRect.Left + 16;
Canvas.Brush.Color := clWhite;
Canvas.FillRect(aRect);
S := index.ToString;
Canvas.Font.Color := clWindowText;
Canvas.TextRect(aRect, aRect.Left+1, aRect.Top+3, S);
end;
end
Steps to reproduce:
Just unzip attached sample projects.
It contains two projects: HostApp and DllApp.
Load and compile.
Start the host app.
Click combobox drop down in the host app and you will see - works fine.
Than
Click the "Test me" button.
This will load dll library and will open test form in the libray.
Click combobox drop down in the dll library form and you will see - the combobox will drops down, but there is nothing in the area.
if you set the breakpoint to the "OnDrawEvent" it will stop, but does not draw anything.
Additional information:
Only inder Windows 32/64
Mantis conversion info:
- Mantis ID: 37982
- OS: Windows
- OS Build: 7/10
- Build: trunk
- Platform: Windows 32/64
- Version: 2.1 (SVN)
- Fixed in revision: r64179 (#b1672671)