mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 23:25:56 +02:00
Gtk2: fix for listbox itemindex. fixes #15784
git-svn-id: trunk@23966 -
This commit is contained in:
parent
3b8ff2f3ba
commit
3d77cd4d3c
@ -373,6 +373,7 @@ var
|
||||
Widget: PGtkWidget;
|
||||
Path: PGtkTreePath;
|
||||
Column: PGtkTreeViewColumn;
|
||||
Selection: PGtkTreeSelection;
|
||||
begin
|
||||
Result := -1;
|
||||
if not WSCheckHandleAllocated(ACustomListBox, 'GetItemIndex') then
|
||||
@ -381,9 +382,17 @@ begin
|
||||
if GtkWidgetIsA(Widget, gtk_tree_view_get_type) then
|
||||
begin
|
||||
gtk_tree_view_get_cursor(PGtkTreeView(Widget), Path, column);
|
||||
|
||||
if Path <> nil then
|
||||
Result := gtk_tree_path_get_indices(Path)^
|
||||
else
|
||||
begin
|
||||
Result := gtk_tree_path_get_indices(Path)^;
|
||||
if Result = 0 then
|
||||
begin
|
||||
Selection := gtk_tree_view_get_selection(PGtkTreeView(Widget));
|
||||
if not gtk_tree_selection_path_is_selected(Selection, Path) then
|
||||
Result := -1;
|
||||
end;
|
||||
end else
|
||||
Result := -1;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user