Ensure ListSessionFocusChanged is called after deletion. Fixes issue #1314

This commit is contained in:
Ansgar Becker
2009-08-21 06:13:24 +00:00
parent 0d3aaacaab
commit eed0c7bbfb

View File

@ -291,6 +291,7 @@ end;
procedure Tconnform.btnDeleteClick(Sender: TObject);
var
SessionKey: String;
Node: PVirtualNode;
begin
if MessageDlg('Delete session "' + SelectedSession + '" ?', mtConfirmation, [mbYes, mbCancel], 0) = mrYes then
begin
@ -300,7 +301,12 @@ begin
FSessionNames.Delete(FSessionNames.IndexOf(SelectedSession));
RefreshSessionList(False);
if (not Assigned(ListSessions.FocusedNode)) and (ListSessions.RootNodeCount > 0) then
SelectNode(ListSessions, ListSessions.RootNodeCount-1);
SelectNode(ListSessions, ListSessions.RootNodeCount-1)
else begin
Node := ListSessions.FocusedNode;
ListSessions.FocusedNode := nil;
ListSessions.FocusedNode := Node;
end;
end;
end;