mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-08 17:00:40 +01:00
fixed TListBox.OnSelectionChanged event (issue #1340)
git-svn-id: trunk@7987 -
This commit is contained in:
parent
fc09495371
commit
7b07d9012d
@ -225,8 +225,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomListBox.IntfSelectionChanged;
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomListBox.LMSelChange(var TheMessage);
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomListBox.LMSelChange(var TheMessage);
|
||||
begin
|
||||
//debugln('TCustomListBox.LMSelChange ',DbgSName(Self),' ',dbgs(ItemIndex));
|
||||
if [csLoading,csDestroying,csDesigning]*ComponentState<>[] then exit;
|
||||
//debugln('TCustomListBox.LMSelChange ',Name,':',ClassName,' ItemIndex=',dbgs(ItemIndex),' FLockSelectionChange=',dbgs(FLockSelectionChange));
|
||||
if FLockSelectionChange=0 then
|
||||
@ -234,22 +238,13 @@ begin
|
||||
DoSelectionChange(FLockSelectionChange=0);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomListBox.LMSelChange(var TheMessage);
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomListBox.LMSelChange(var TheMessage);
|
||||
procedure TCustomListBox.WMLButtonUp(var Message: TLMLButtonUp);
|
||||
begin
|
||||
//debugln('TCustomListBox.LMSelChange ',DbgSName(Self),' ',dbgs(ItemIndex));
|
||||
IntfSelectionChanged;
|
||||
end;
|
||||
|
||||
procedure TCustomListBox.WMLButtonDown(var Message: TLMLButtonDown);
|
||||
begin
|
||||
//debugln('TCustomListBox.WMLButtonDown ',DbgSName(Self),' ',dbgs(ItemIndex));
|
||||
inherited WMLButtonDown(Message);
|
||||
// prevent Click to be called twice when using selchange as click
|
||||
if ClickOnSelChange and FClickTriggeredBySelectionChange then
|
||||
Exclude(FControlState, csClicked);
|
||||
//debugln('TCustomListBox.WMLButtonDown ',DbgSName(Self),' ',dbgs(ItemIndex));
|
||||
inherited WMLButtonUp(Message);
|
||||
// reset flag
|
||||
FClickTriggeredBySelectionChange:=false;
|
||||
end;
|
||||
|
||||
@ -542,9 +542,6 @@ begin
|
||||
Windows.SendMessage(Handle, LB_SETSEL, Windows.WParam(true), Windows.LParam(AIndex));
|
||||
end else
|
||||
Windows.SendMessage(Handle, LB_SETCURSEL, Windows.WParam(AIndex), 0);
|
||||
|
||||
// windows does not send selection changed notify message
|
||||
ACustomListBox.IntfSelectionChanged;
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomListBox.SetSelectionMode(const ACustomListBox: TCustomListBox;
|
||||
|
||||
@ -420,7 +420,7 @@ type
|
||||
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 WMLButtonUp(Var Message: TLMLButtonUp); message LM_LBUTTONUP;
|
||||
procedure SendItemSelected(Index: integer; IsSelected: boolean);
|
||||
protected
|
||||
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); virtual; // called to store item data while the handle isn't created
|
||||
@ -464,10 +464,6 @@ type
|
||||
procedure Clear; virtual;
|
||||
procedure LockSelectionChange;
|
||||
procedure UnlockSelectionChange;
|
||||
public
|
||||
{ to be called by widgetset backend }
|
||||
// equivalent of LM_SELCHANGED
|
||||
procedure IntfSelectionChanged; virtual;
|
||||
public
|
||||
property Align;
|
||||
property Anchors;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user