mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 06:19:47 +02:00
fixed crashed with csOwnerDrawVariable combobox style (bug #934) from Jesus
git-svn-id: trunk@7236 -
This commit is contained in:
parent
f9efe7ac15
commit
903c6d561e
@ -375,11 +375,12 @@ end;
|
||||
procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
skip : Boolean;
|
||||
UserDropDown: boolean;
|
||||
begin
|
||||
Skip := False;
|
||||
UserDropDown := ((Shift *[ssCtrl] = [ssCtrl]) and (Key = VK_DOWN));
|
||||
|
||||
if AutoDropDown or ((Shift *[ssCtrl] = [ssCtrl]) and (Key = VK_DOWN))
|
||||
or FReturnArrowState then
|
||||
if AutoDropDown or UserDropDown or FReturnArrowState then
|
||||
begin
|
||||
case Key of
|
||||
VK_TAB,VK_RETURN:
|
||||
@ -403,7 +404,8 @@ begin
|
||||
end;
|
||||
//AutoDropDown := True;
|
||||
DroppedDown := True;
|
||||
|
||||
if UserDropDown then
|
||||
Skip := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -773,6 +775,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.LMMeasureItem(var TheMessage: TLMMeasureItem);
|
||||
var
|
||||
AHeight: Integer;
|
||||
begin
|
||||
with TheMessage.MeasureItemStruct^ do begin
|
||||
if Self.ItemHeight <> 0 then
|
||||
AHeight := Self.ItemHeight
|
||||
else
|
||||
Aheight := ItemHeight;
|
||||
MeasureItem(ItemId, AHeight);
|
||||
if AHeight>0 then
|
||||
ItemHeight := AHeight;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomComboBox.CNCommand(var TheMessage: TLMCommand);
|
||||
|
||||
@ -817,6 +834,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.61 2005/06/13 08:04:38 vincents
|
||||
fixed crashed with csOwnerDrawVariable combobox style (bug 934) from Jesus
|
||||
|
||||
Revision 1.60 2005/03/22 20:55:26 micha
|
||||
setting sorted to false should be propagated to internal stringlist (by jesusrmx)
|
||||
|
||||
|
@ -210,6 +210,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomListBox.LMMeasureItem(var TheMessage: TLMMeasureItem);
|
||||
var
|
||||
AHeight: Integer;
|
||||
begin
|
||||
with TheMessage.MeasureItemStruct^ do begin
|
||||
if Self.ItemHeight <> 0 then
|
||||
AHeight := Self.ItemHeight
|
||||
else
|
||||
Aheight := ItemHeight;
|
||||
MeasureItem(ItemId, AHeight);
|
||||
if AHeight>0 then
|
||||
ItemHeight := AHeight;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomListBox.IntfSelectionChanged;
|
||||
begin
|
||||
if [csLoading,csDestroying,csDesigning]*ComponentState<>[] then exit;
|
||||
|
@ -751,14 +751,18 @@ Begin
|
||||
Begin
|
||||
// TODO: this could crash for a MenuItem.
|
||||
WindowInfo := GetWindowInfo(PDrawItemStruct(LParam)^.hwndItem);
|
||||
lWinControl := WindowInfo^.WinControl;
|
||||
if WindowInfo^.WinControl<>nil then
|
||||
lWinControl := WindowInfo^.WinControl;
|
||||
{$IFDEF MSG_DEBUG|}
|
||||
with PDrawItemStruct(LParam)^ do
|
||||
writeln(format('Received WM_DRAWITEM type %d handle %x', [ctlType, hwndItem]));
|
||||
{$ENDIF}
|
||||
|
||||
if (lWinControl is TCustomListbox) and
|
||||
(TCustomListBox(lWinControl).Style <> lbStandard) then
|
||||
if ((lWinControl is TCustomListbox) and
|
||||
(TCustomListBox(lWinControl).Style <> lbStandard)) or
|
||||
((lWinControl is TCustomCombobox) and
|
||||
((TCustomCombobox(lWinControl).Style = csOwnerDrawFixed) or
|
||||
(TCustomCombobox(lWinControl).Style = csOwnerDrawVariable))) then
|
||||
begin
|
||||
LMessage.Msg := LM_DRAWLISTITEM;
|
||||
TLMDrawListItem(LMessage).DrawListItemStruct := @DrawListItemStruct;
|
||||
@ -1230,14 +1234,29 @@ Begin
|
||||
End;
|
||||
WM_MEASUREITEM:
|
||||
Begin
|
||||
if TObject(WParam) is TWinControl then
|
||||
begin
|
||||
lWinControl := TWinControl(WParam);
|
||||
LMessage.Msg := LM_MEASUREITEM;
|
||||
LMessage.LParam := LParam;
|
||||
LMessage.WParam := WParam;
|
||||
end else
|
||||
lWinControl := nil;
|
||||
if LWinControl<>nil then begin
|
||||
if LWinControl is TCustomCombobox then begin
|
||||
LMessage.Msg := LM_MEASUREITEM;
|
||||
LMessage.LParam := LParam;
|
||||
LMessage.WParam := WParam;
|
||||
Winprocess := False;
|
||||
end else
|
||||
if WParam=0 then begin
|
||||
// todo: it's a menu
|
||||
end else begin
|
||||
// find child handle based on it's CtlID
|
||||
TargetWindow := GetDlgItem(Window, WParam);
|
||||
if TargetWindow<>0 then begin
|
||||
LWinControl := GetWindowInfo(TargetWindow)^.WinControl;
|
||||
if LWinControl<>nil then begin
|
||||
LMessage.Msg := LM_MEASUREITEM;
|
||||
LMessage.LParam := LParam;
|
||||
LMessage.WParam := WParam;
|
||||
Winprocess := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
WM_THEMECHANGED:
|
||||
begin
|
||||
@ -1582,6 +1601,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.209 2005/06/13 08:04:38 vincents
|
||||
fixed crashed with csOwnerDrawVariable combobox style (bug 934) from Jesus
|
||||
|
||||
Revision 1.208 2005/06/01 18:55:59 micha
|
||||
fix painting of panels on notebooks with themes (fixes bug 915)
|
||||
|
||||
|
@ -249,6 +249,7 @@ type
|
||||
procedure SetItemWidth(const AValue: Integer);
|
||||
procedure SetItems(Value: TStrings);
|
||||
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
|
||||
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
|
||||
procedure CNCommand(var TheMessage: TLMCommand); message CN_Command;
|
||||
procedure UpdateSorted;
|
||||
procedure SetArrowKeysTraverseList(Value: Boolean);
|
||||
@ -384,6 +385,8 @@ type
|
||||
TListBoxStyle = (lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable);
|
||||
TSelectionChangeEvent = procedure(Sender: TObject; User: boolean) of object;
|
||||
|
||||
{ TCustomListBox }
|
||||
|
||||
TCustomListBox = class(TWinControl)
|
||||
private
|
||||
FCacheValid: Boolean;
|
||||
@ -408,6 +411,7 @@ type
|
||||
procedure UpdateSelectionMode;
|
||||
procedure UpdateSorted;
|
||||
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
|
||||
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
|
||||
procedure LMSelChange(var TheMessage); message LM_SelChange;
|
||||
procedure WMLButtonDown(Var Message: TLMLButtonDown); message LM_LBUTTONDOWN;
|
||||
procedure SendItemSelected(Index: integer; IsSelected: boolean);
|
||||
@ -1258,6 +1262,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.207 2005/06/13 08:04:38 vincents
|
||||
fixed crashed with csOwnerDrawVariable combobox style (bug 934) from Jesus
|
||||
|
||||
Revision 1.206 2005/05/26 22:15:51 mattias
|
||||
fixed triggering TListBox.Click when clicking on selected item
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user