mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 17:58:18 +02:00
fixed deleting selected TListBox item under gtk1 from Collin
git-svn-id: trunk@6946 -
This commit is contained in:
parent
6d17a20f5d
commit
08fd79653c
@ -592,6 +592,8 @@ end;
|
|||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStringList.Delete(Index: integer);
|
procedure TGtkListStringList.Delete(Index: integer);
|
||||||
|
var
|
||||||
|
Next: PGList;
|
||||||
begin
|
begin
|
||||||
UpdateItemCache;
|
UpdateItemCache;
|
||||||
RemoveItemCallbacks(Index);
|
RemoveItemCallbacks(Index);
|
||||||
@ -607,6 +609,16 @@ begin
|
|||||||
ReAllocMem(FCachedItems,SizeOf(PGtkListItem)*FCachedCapacity);
|
ReAllocMem(FCachedItems,SizeOf(PGtkListItem)*FCachedCapacity);
|
||||||
end;
|
end;
|
||||||
// remove item from gtk list
|
// remove item from gtk list
|
||||||
|
{$IFDEF Gtk1}
|
||||||
|
{ Work round gtk bug - crashes if deleting first item in list
|
||||||
|
and item has focus and there are remaining items }
|
||||||
|
if (Index = 0) and (PGTKContainer(FGtkList)^.focus_child <> nil)
|
||||||
|
and (gtk_list_child_position(FGtkList,PGTKContainer(FGtkList)^.focus_child) = 0) then begin
|
||||||
|
Next := FGtkList^.children^.next;
|
||||||
|
if Next <> nil then
|
||||||
|
gtk_widget_grab_focus(Next^.data);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
gtk_list_clear_items(FGtkList, Index, Index + 1);
|
gtk_list_clear_items(FGtkList, Index, Index + 1);
|
||||||
{$IFDEF CheckGtkList}
|
{$IFDEF CheckGtkList}
|
||||||
ConsistencyCheck;
|
ConsistencyCheck;
|
||||||
@ -964,6 +976,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.30 2005/03/13 22:35:17 mattias
|
||||||
|
fixed deleting selected TListBox item under gtk1 from Collin
|
||||||
|
|
||||||
Revision 1.29 2005/03/07 21:59:45 vincents
|
Revision 1.29 2005/03/07 21:59:45 vincents
|
||||||
changed hexstr(cardinal()) for pointers to dbgs() and other 64-bits fixes from Peter Vreman
|
changed hexstr(cardinal()) for pointers to dbgs() and other 64-bits fixes from Peter Vreman
|
||||||
|
|
||||||
|
@ -5029,6 +5029,7 @@ begin
|
|||||||
GDIObj^.GDIFontObject:= GetDefaultFont(true);
|
GDIObj^.GDIFontObject:= GetDefaultFont(true);
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
Result := hFont(GDIObj);
|
Result := hFont(GDIObj);
|
||||||
|
;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -7918,10 +7919,22 @@ begin
|
|||||||
ImplWidget:= WinWidgetInfo^.CoreWidget;
|
ImplWidget:= WinWidgetInfo^.CoreWidget;
|
||||||
if ImplWidget <> nil then begin
|
if ImplWidget <> nil then begin
|
||||||
// handle has a ImplementationWidget
|
// handle has a ImplementationWidget
|
||||||
{$IfDef VerboseFocus}
|
if GtkWidgetIsA(ImplWidget, gtk_list_get_type) then begin
|
||||||
DebugLn(' E taking ImplementationWidget');
|
{$IfDef VerboseFocus}
|
||||||
{$EndIf}
|
DebugLn(' E using list');
|
||||||
NewFocusWidget:=ImplWidget;
|
{$EndIf}
|
||||||
|
if selection_mode(PGtkList(ImplWidget)^) > GTK_SELECTION_BROWSE then
|
||||||
|
NewFocusWidget:=PGtkList(ImplWidget)^.last_focus_child;
|
||||||
|
if (NewFocusWidget = nil) and (PGtkList(ImplWidget)^.selection <> nil) then
|
||||||
|
NewFocusWidget := (PGtkList(ImplWidget)^.selection)^.data;
|
||||||
|
if (NewFocusWidget = nil) and (gtk_container_children(PGtkContainer(ImplWidget)) <> nil) then
|
||||||
|
NewFocusWidget := g_list_first(gtk_container_children(PGtkContainer(ImplWidget)))^.data;
|
||||||
|
end else begin
|
||||||
|
{$IfDef VerboseFocus}
|
||||||
|
DebugLn(' E taking ImplementationWidget');
|
||||||
|
{$EndIf}
|
||||||
|
NewFocusWidget:=ImplWidget;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -8953,6 +8966,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.408 2005/03/13 22:35:17 mattias
|
||||||
|
fixed deleting selected TListBox item under gtk1 from Collin
|
||||||
|
|
||||||
Revision 1.407 2005/03/08 00:28:03 mattias
|
Revision 1.407 2005/03/08 00:28:03 mattias
|
||||||
implemented gtk2 AppMinimize
|
implemented gtk2 AppMinimize
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user