- Added hints to the "Restriction" column in the account list
- Reset the sorting when the list content changes
This commit is contained in:
parent
977e53085a
commit
de33600726
|
@ -112,7 +112,10 @@ object frmAccountControl: TfrmAccountControl
|
||||||
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
|
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
Header.Style = hsFlatButtons
|
Header.Style = hsFlatButtons
|
||||||
|
HintMode = hmHint
|
||||||
Images = ilAccesslevel
|
Images = ilAccesslevel
|
||||||
|
ParentShowHint = False
|
||||||
|
ShowHint = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TreeOptions.AutoOptions = [toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
TreeOptions.AutoOptions = [toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
||||||
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
|
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
|
||||||
|
@ -123,6 +126,7 @@ object frmAccountControl: TfrmAccountControl
|
||||||
OnFreeNode = vstAccountsFreeNode
|
OnFreeNode = vstAccountsFreeNode
|
||||||
OnGetText = vstAccountsGetText
|
OnGetText = vstAccountsGetText
|
||||||
OnGetImageIndex = vstAccountsGetImageIndex
|
OnGetImageIndex = vstAccountsGetImageIndex
|
||||||
|
OnGetHint = vstAccountsGetHint
|
||||||
OnHeaderClick = vstAccountsHeaderClick
|
OnHeaderClick = vstAccountsHeaderClick
|
||||||
end
|
end
|
||||||
object ilToolbar: TImageList
|
object ilToolbar: TImageList
|
||||||
|
|
|
@ -59,6 +59,9 @@ type
|
||||||
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
|
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
|
||||||
procedure vstAccountsDblClick(Sender: TObject);
|
procedure vstAccountsDblClick(Sender: TObject);
|
||||||
procedure vstAccountsFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
procedure vstAccountsFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||||
|
procedure vstAccountsGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||||
|
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
|
||||||
|
var HintText: String);
|
||||||
procedure vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
procedure vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
var Ghosted: Boolean; var ImageIndex: Integer);
|
var Ghosted: Boolean; var ImageIndex: Integer);
|
||||||
|
@ -71,6 +74,8 @@ type
|
||||||
procedure OnDeleteUserResponse(ABuffer: TEnhancedMemoryStream);
|
procedure OnDeleteUserResponse(ABuffer: TEnhancedMemoryStream);
|
||||||
procedure OnListUsersPacket(ABuffer: TEnhancedMemoryStream);
|
procedure OnListUsersPacket(ABuffer: TEnhancedMemoryStream);
|
||||||
function FindNode(AUsername: string): PVirtualNode;
|
function FindNode(AUsername: string): PVirtualNode;
|
||||||
|
private
|
||||||
|
procedure OnListModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -276,6 +281,20 @@ begin
|
||||||
if accountInfo^.Regions <> nil then FreeAndNil(accountInfo^.Regions);
|
if accountInfo^.Regions <> nil then FreeAndNil(accountInfo^.Regions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.vstAccountsGetHint(Sender: TBaseVirtualTree;
|
||||||
|
Node: PVirtualNode; Column: TColumnIndex;
|
||||||
|
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: String);
|
||||||
|
var
|
||||||
|
accountInfo: PAccountInfo;
|
||||||
|
begin
|
||||||
|
if Column = 3 then
|
||||||
|
begin
|
||||||
|
accountInfo := Sender.GetNodeData(Node);
|
||||||
|
if accountInfo^.Regions.Count > 0 then
|
||||||
|
HintText := Trim(accountInfo^.Regions.Text);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAccountControl.vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
procedure TfrmAccountControl.vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||||
var Ghosted: Boolean; var ImageIndex: Integer);
|
var Ghosted: Boolean; var ImageIndex: Integer);
|
||||||
|
@ -360,6 +379,7 @@ begin
|
||||||
regions := ABuffer.ReadByte;
|
regions := ABuffer.ReadByte;
|
||||||
for i := 0 to regions - 1 do
|
for i := 0 to regions - 1 do
|
||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been added.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been added.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
|
@ -375,6 +395,7 @@ begin
|
||||||
regions := ABuffer.ReadByte;
|
regions := ABuffer.ReadByte;
|
||||||
for i := 0 to regions - 1 do
|
for i := 0 to regions - 1 do
|
||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been modified.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been modified.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
|
@ -401,6 +422,8 @@ begin
|
||||||
if node <> nil then
|
if node <> nil then
|
||||||
begin
|
begin
|
||||||
vstAccounts.DeleteNode(node);
|
vstAccounts.DeleteNode(node);
|
||||||
|
OnListModified;
|
||||||
|
|
||||||
Messagedlg('Success', Format('The user "%s" has been deleted.', [username]),
|
Messagedlg('Success', Format('The user "%s" has been deleted.', [username]),
|
||||||
mtInformation, [mbOK], 0);
|
mtInformation, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
|
@ -433,6 +456,7 @@ begin
|
||||||
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
|
||||||
end;
|
end;
|
||||||
vstAccounts.EndUpdate;
|
vstAccounts.EndUpdate;
|
||||||
|
OnListModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrmAccountControl.FindNode(AUsername: string): PVirtualNode;
|
function TfrmAccountControl.FindNode(AUsername: string): PVirtualNode;
|
||||||
|
@ -451,6 +475,11 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAccountControl.OnListModified;
|
||||||
|
begin
|
||||||
|
vstAccounts.Header.SortColumn := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I UfrmAccountControl.lrs}
|
{$I UfrmAccountControl.lrs}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue