Gtk2: fixed TListBox with ItemIndex = -1 in lfm. issue #27276

git-svn-id: trunk@47330 -
This commit is contained in:
zeljko 2015-01-11 09:43:43 +00:00
parent 60baaafb4a
commit 5b71531582

View File

@ -175,6 +175,7 @@ type
class procedure SetSorted(const {%H-}ACustomListBox: TCustomListBox; AList: TStrings; ASorted: boolean); override;
class procedure SetTopIndex(const ACustomListBox: TCustomListBox; const NewTopIndex: integer); override;
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
end;
{ TGtk2WSListBox }
@ -683,6 +684,15 @@ begin
Gtk2WidgetSet.SetWidgetFont(Widget, AFont);
end;
class procedure TGtk2WSCustomListBox.ShowHide(const AWinControl: TWinControl);
begin
// issue #27276
if AWinControl.HandleAllocated and AWinControl.HandleObjectShouldBeVisible and
(TCustomListBox(AWinControl).ItemIndex = -1) then
SetItemIndex(TCustomListBox(AWinControl), TCustomListBox(AWinControl).ItemIndex);
inherited ShowHide(AWinControl);
end;
function gtk2ListBoxSelectionChangedAfter({%H-}Widget: PGtkWidget;
WidgetInfo: PWidgetInfo): gboolean; cdecl;
var