Skip to content
Snippets Groups Projects
Commit c31203fc authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add keyboard shortcuts to Clients list view: Ctrl-A, Ctrl-F and Del

Ctrl-A - Select All
Ctrl-F - Filter IP address
DEL - Close Socket

Also, use Begin/EndUpdate() calls to batch updates to the ListView in Timer
tick (no visible difference, but it's the right thing to do).

I don't know why C++Builder increased the TextHeight value of this form from
13 to 15, but doesn't seem to really matter (or at least, I couldn't tell).
parent 513715f0
No related branches found
No related tags found
No related merge requests found
Pipeline #6605 passed
......@@ -57,6 +57,7 @@ void __fastcall TClientForm::TimerTimer(TObject *Sender)
if(WaitForSingleObject(ListMutex,1)!=WAIT_OBJECT_0)
return;
ListView->Items->BeginUpdate();
for(i=0;i<ListView->Items->Count;i++) {
t=time(NULL)-(ulong)ListView->Items->Item[i]->Data;
if(t/(60*60))
......@@ -66,8 +67,8 @@ void __fastcall TClientForm::TimerTimer(TObject *Sender)
ListView->Items->Item[i]->SubItems->Strings[5]=str;
}
ListView->Items->EndUpdate();
ReleaseMutex(ListMutex);
}
//---------------------------------------------------------------------------
......@@ -158,3 +159,10 @@ void __fastcall TClientForm::FilterIpMenuItemClick(TObject *Sender)
}
//---------------------------------------------------------------------------
void __fastcall TClientForm::SelectAllMenuItemClick(TObject *Sender)
{
for(int i = 0; i < ListView->Items->Count; ++i)
ListView->Items->Item[i]->Selected = true;
}
//---------------------------------------------------------------------------
......@@ -16,38 +16,38 @@ object ClientForm: TClientForm
OldCreateOrder = False
OnHide = FormHide
PixelsPerInch = 96
TextHeight = 13
TextHeight = 15
object ListView: TListView
Left = 0
Top = 0
Width = 615
Height = 307
Height = 306
Align = alClient
Color = clBlack
Columns = <
item
Caption = 'Socket'
Width = 49
Width = 57
end
item
Caption = 'Protocol'
Width = 53
Width = 61
end
item
Caption = 'User'
Width = 73
Width = 84
end
item
Caption = 'Address'
Width = 81
Width = 93
end
item
Caption = 'Host Name'
Width = 81
Width = 93
end
item
Caption = 'Port'
Width = 45
Width = 52
end
item
AutoSize = True
......@@ -72,11 +72,21 @@ object ClientForm: TClientForm
Top = 200
object CloseSocketMenuItem: TMenuItem
Caption = '&Close Socket'
ShortCut = 46
OnClick = CloseSocketMenuItemClick
end
object FilterIpMenuItem: TMenuItem
Caption = '&Filter IP Address'
ShortCut = 16454
OnClick = FilterIpMenuItemClick
end
object N1: TMenuItem
Caption = '-'
end
object SelectAllMenuItem: TMenuItem
Caption = 'Select All'
ShortCut = 16449
OnClick = SelectAllMenuItemClick
end
end
end
......@@ -55,10 +55,13 @@ __published: // IDE-managed Components
TPopupMenu *PopupMenu;
TMenuItem *CloseSocketMenuItem;
TMenuItem *FilterIpMenuItem;
TMenuItem *N1;
TMenuItem *SelectAllMenuItem;
void __fastcall FormHide(TObject *Sender);
void __fastcall TimerTimer(TObject *Sender);
void __fastcall CloseSocketMenuItemClick(TObject *Sender);
void __fastcall FilterIpMenuItemClick(TObject *Sender);
void __fastcall SelectAllMenuItemClick(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TClientForm(TComponent* Owner);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment