mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:19:16 +02:00
implemented TComboBox.OnSelect from Andrew Haines
git-svn-id: trunk@7681 -
This commit is contained in:
parent
6c4c6cdbd2
commit
9e4a4eeb01
@ -640,7 +640,7 @@ type
|
||||
procedure Delete(const AIndex : Integer);
|
||||
function FindCaption(StartIndex: Integer; Value: string;
|
||||
Partial, Inclusive, Wrap: Boolean;
|
||||
PartStart: Boolean{$IFNDEF 1_0} = True{$ENDIF}): TListItem;
|
||||
PartStart: Boolean = True): TListItem;
|
||||
function FindData(const AData: Pointer): TListItem;
|
||||
function Insert(const AIndex: Integer) : TListItem;
|
||||
procedure InsertItem(AItem: TListItem; const AIndex: Integer);
|
||||
|
@ -796,6 +796,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.LMSelChange(var TheMessage);
|
||||
begin
|
||||
if [csLoading,csDestroying,csDesigning]*ComponentState<>[] then exit;
|
||||
if Assigned(OnSelect) then
|
||||
OnSelect(Self);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomComboBox.CNCommand(var TheMessage: TLMCommand);
|
||||
|
||||
|
@ -163,6 +163,32 @@ begin
|
||||
DeliverMessage(LCLList.Owner, Mess);
|
||||
end;
|
||||
|
||||
procedure GtkListItemSelectAfterCB(Widget: PGtkWidget; data: gpointer); cdecl;
|
||||
var
|
||||
GtkList: PGtkList;
|
||||
LCLList: TGtkListStringList;
|
||||
//ItemIndex: LongInt;
|
||||
Mess: TLMessage;
|
||||
begin
|
||||
// get context
|
||||
GtkList:=PGtkList(gtk_object_get_data(PGtkObject(Data),GtkListItemGtkListTag));
|
||||
if GtkList=nil then
|
||||
RaiseException('gtkListItemSelectAfterCB GtkList=nil');
|
||||
LCLList:=TGtkListStringList(gtk_object_get_data(PGtkObject(Data),
|
||||
GtkListItemLCLListTag));
|
||||
if LCLList=nil then
|
||||
RaiseException('gtkListItemSelectAfterCB LCLList=nil');
|
||||
if [csDestroying,csLoading]*LCLList.Owner.ComponentState<>[] then exit;
|
||||
|
||||
// get itemindex and area
|
||||
//ItemIndex:=g_list_index(GtkList^.children,Data);
|
||||
|
||||
if LockOnChange(PgtkObject(Widget),0) > 0 then Exit;
|
||||
|
||||
Mess.Msg := LM_SELCHANGE;
|
||||
Mess.Result := 0;
|
||||
DeliverMessage(LCLList.Owner, Mess);
|
||||
end;
|
||||
{*************************************************************}
|
||||
{ TGtkListStringList methods }
|
||||
{*************************************************************}
|
||||
@ -280,6 +306,10 @@ begin
|
||||
g_signal_connect_after(G_OBJECT(ChildWidget), 'toggled',
|
||||
G_CALLBACK(@gtkListItemToggledCB), li);
|
||||
end;
|
||||
if FOwner is TCustomComboBox then begin
|
||||
gtk_signal_connect_after(PGtkObject(li), 'select',
|
||||
TGTKSignalFunc(@gtkListItemSelectAfterCB),li);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -253,6 +253,7 @@ type
|
||||
procedure SetItems(Value: TStrings);
|
||||
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
|
||||
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
|
||||
procedure LMSelChange(var TheMessage); message LM_SelChange;
|
||||
procedure CNCommand(var TheMessage: TLMCommand); message CN_Command;
|
||||
procedure SetReadOnly(const AValue: Boolean);
|
||||
procedure UpdateSorted;
|
||||
|
Loading…
Reference in New Issue
Block a user