mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 20:59:12 +02:00
Fixed gtk2 combobox OnDropDown and OnCloseUp to be more reliable
git-svn-id: trunk@12594 -
This commit is contained in:
parent
aa3499494a
commit
a924505277
@ -886,6 +886,7 @@ end;
|
|||||||
procedure GtkNotifyCB(AObject: PGObject; pspec: PGParamSpec; WidgetInfo: PWidgetInfo); cdecl;
|
procedure GtkNotifyCB(AObject: PGObject; pspec: PGParamSpec; WidgetInfo: PWidgetInfo); cdecl;
|
||||||
var
|
var
|
||||||
AValue: TGValue;
|
AValue: TGValue;
|
||||||
|
AMenu: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
if pspec^.name = 'popup-shown' then
|
if pspec^.name = 'popup-shown' then
|
||||||
begin
|
begin
|
||||||
@ -895,7 +896,11 @@ begin
|
|||||||
if AValue.data[0].v_int = 0 then // if 0 = False then it is close up
|
if AValue.data[0].v_int = 0 then // if 0 = False then it is close up
|
||||||
g_idle_add(@GtkPopupCloseUp, WidgetInfo)
|
g_idle_add(@GtkPopupCloseUp, WidgetInfo)
|
||||||
else // in other case it is drop down
|
else // in other case it is drop down
|
||||||
|
begin
|
||||||
LCLSendDropDownMsg(TControl(WidgetInfo^.LCLObject));
|
LCLSendDropDownMsg(TControl(WidgetInfo^.LCLObject));
|
||||||
|
AMenu := PGtkComboBoxPrivate(PGtkComboBox(WidgetInfo^.CoreWidget)^.priv)^.popup_widget;
|
||||||
|
gtk_menu_reposition(PGtkMenu(AMenu));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -958,9 +963,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
g_signal_connect(ComboWidget, 'changed', TGCallback(@GtkChangedCB), AWidgetInfo);
|
g_signal_connect(ComboWidget, 'changed', TGCallback(@GtkChangedCB), AWidgetInfo);
|
||||||
{$ifdef windows}
|
|
||||||
g_signal_connect(ComboWidget, 'notify', TGCallback(@GtkNotifyCB), AWidgetInfo);
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
// First the combo (or the entry)
|
// First the combo (or the entry)
|
||||||
if gtk_is_combo_box_entry(ComboWidget) then begin
|
if gtk_is_combo_box_entry(ComboWidget) then begin
|
||||||
@ -1013,12 +1015,16 @@ begin
|
|||||||
and (GTK_IS_MENU(APrivate^.popup_window)) then
|
and (GTK_IS_MENU(APrivate^.popup_window)) then
|
||||||
AMenu := GTK_OBJECT(APrivate^.popup_window);
|
AMenu := GTK_OBJECT(APrivate^.popup_window);
|
||||||
|
|
||||||
if Assigned(AMenu) then
|
if Assigned(AMenu) and (gtk_major_version = 2) and (gtk_minor_version < 10) then
|
||||||
begin
|
begin
|
||||||
g_signal_connect(AMenu, 'show', G_CALLBACK(@GtkPopupShowCB), AWidgetInfo);
|
g_signal_connect(AMenu, 'show', G_CALLBACK(@GtkPopupShowCB), AWidgetInfo);
|
||||||
g_signal_connect_after(AMenu, 'selection-done', G_CALLBACK(@GtkPopupHideCB), AWidgetInfo);
|
g_signal_connect_after(AMenu, 'selection-done', G_CALLBACK(@GtkPopupHideCB), AWidgetInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (gtk_major_version >= 2) and (gtk_minor_version >= 10) then
|
||||||
|
g_signal_connect(ComboWidget, 'notify', TGCallback(@GtkNotifyCB), AWidgetInfo);
|
||||||
|
|
||||||
|
|
||||||
// g_signal_connect(ComboWidget, 'set-focus-child', TGCallback(@GtkPopupShowCB), AWidgetInfo);
|
// g_signal_connect(ComboWidget, 'set-focus-child', TGCallback(@GtkPopupShowCB), AWidgetInfo);
|
||||||
g_object_set_data(G_OBJECT(AWidget), 'Menu', APrivate^.popup_widget);
|
g_object_set_data(G_OBJECT(AWidget), 'Menu', APrivate^.popup_widget);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user