mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:59:17 +02:00
added TCheckListBox.OnItemClick
git-svn-id: trunk@9603 -
This commit is contained in:
parent
b399abb1a0
commit
0e494526fd
@ -33,18 +33,20 @@ uses
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TCheckListClicked = procedure(Sender: TObject; Index: integer) of object;
|
||||||
|
|
||||||
{ TCustomCheckListBox }
|
{ TCustomCheckListBox }
|
||||||
|
|
||||||
TCustomCheckListBox = class(TCustomListBox)
|
TCustomCheckListBox = class(TCustomListBox)
|
||||||
private
|
private
|
||||||
FItemDataOffset: Integer;
|
FItemDataOffset: Integer;
|
||||||
FOnClickChecked : tNotifyEvent;
|
FOnClickChecked : TNotifyEvent;
|
||||||
|
FOnItemClick: TCheckListClicked;
|
||||||
function GetChecked(const AIndex: Integer): Boolean;
|
function GetChecked(const AIndex: Integer): Boolean;
|
||||||
function GetCount: integer;
|
function GetCount: integer;
|
||||||
procedure SetChecked(const AIndex: Integer; const AValue: Boolean);
|
procedure SetChecked(const AIndex: Integer; const AValue: Boolean);
|
||||||
procedure SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
|
procedure SendItemChecked(const AIndex: Integer; const AChecked: Boolean);
|
||||||
procedure DoChange(var Msg); message LM_CHANGED;
|
procedure DoChange(var Msg: TLMessage); message LM_CHANGED;
|
||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
protected
|
protected
|
||||||
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); override;
|
||||||
@ -58,7 +60,8 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
property Checked[const AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
property Checked[const AIndex: Integer]: Boolean read GetChecked write SetChecked;
|
||||||
property Count: integer read GetCount;
|
property Count: integer read GetCount;
|
||||||
property OnClickChecked:tNotifyEvent read FOnClickChecked write FOnClickChecked;
|
property OnClickChecked: TNotifyEvent read FOnClickChecked write FOnClickChecked;
|
||||||
|
property OnItemClick: TCheckListClicked read FOnItemClick write FOnItemClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -80,6 +83,7 @@ type
|
|||||||
property OnDrawItem;
|
property OnDrawItem;
|
||||||
property OnEnter;
|
property OnEnter;
|
||||||
property OnExit;
|
property OnExit;
|
||||||
|
property OnItemClick;
|
||||||
property OnKeyPress;
|
property OnKeyPress;
|
||||||
property OnKeyDown;
|
property OnKeyDown;
|
||||||
property OnKeyUp;
|
property OnKeyUp;
|
||||||
@ -138,9 +142,11 @@ begin
|
|||||||
FItemDataOffset := inherited GetCachedDataSize;
|
FItemDataOffset := inherited GetCachedDataSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomCheckListBox.DoChange(var Msg);
|
procedure TCustomCheckListBox.DoChange(var Msg: TLMessage);
|
||||||
begin
|
begin
|
||||||
clickChecked;
|
//DebugLn(['TCustomCheckListBox.DoChange ',DbgSName(Self),' ',Msg.WParam]);
|
||||||
|
ClickChecked;
|
||||||
|
if Assigned(OnItemClick) then OnItemClick(Self,Msg.WParam);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCheckListBox.GetCachedDataSize: Integer;
|
function TCustomCheckListBox.GetCachedDataSize: Integer;
|
||||||
|
@ -135,8 +135,8 @@ function gtkListItemToggledCB(Widget: PGtkWidget; Data: gPointer): GBoolean; cde
|
|||||||
var
|
var
|
||||||
GtkList: PGtkList;
|
GtkList: PGtkList;
|
||||||
LCLList: TGtkListStringList;
|
LCLList: TGtkListStringList;
|
||||||
//ItemIndex: LongInt;
|
|
||||||
Mess: TLMessage;
|
Mess: TLMessage;
|
||||||
|
ItemIndex: LongInt;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ begin
|
|||||||
if [csDestroying,csLoading]*LCLList.Owner.ComponentState<>[] then exit;
|
if [csDestroying,csLoading]*LCLList.Owner.ComponentState<>[] then exit;
|
||||||
|
|
||||||
// get itemindex and area
|
// get itemindex and area
|
||||||
//ItemIndex:=g_list_index(GtkList^.children,Data);
|
ItemIndex:=g_list_index(GtkList^.children,Data);
|
||||||
|
|
||||||
if LockOnChange(PgtkObject(Widget),0) > 0 then Exit;
|
if LockOnChange(PgtkObject(Widget),0) > 0 then Exit;
|
||||||
|
|
||||||
@ -163,6 +163,8 @@ begin
|
|||||||
|
|
||||||
Mess.Msg := LM_CHANGED;
|
Mess.Msg := LM_CHANGED;
|
||||||
Mess.Result := 0;
|
Mess.Result := 0;
|
||||||
|
Mess.WParam := ItemIndex;
|
||||||
|
//DebugLn(['gtkListItemToggledCB ',ItemIndex]);
|
||||||
DeliverMessage(LCLList.Owner, Mess);
|
DeliverMessage(LCLList.Owner, Mess);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user