- Added hints to the "Restriction" column in the account list

- Reset the sorting when the list content changes
This commit is contained in:
Andreas Schneider 2011-03-26 12:29:31 +01:00
parent 977e53085a
commit de33600726
2 changed files with 33 additions and 0 deletions

View File

@ -112,7 +112,10 @@ object frmAccountControl: TfrmAccountControl
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
Header.ParentFont = True
Header.Style = hsFlatButtons
HintMode = hmHint
Images = ilAccesslevel
ParentShowHint = False
ShowHint = True
TabOrder = 1
TreeOptions.AutoOptions = [toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
@ -123,6 +126,7 @@ object frmAccountControl: TfrmAccountControl
OnFreeNode = vstAccountsFreeNode
OnGetText = vstAccountsGetText
OnGetImageIndex = vstAccountsGetImageIndex
OnGetHint = vstAccountsGetHint
OnHeaderClick = vstAccountsHeaderClick
end
object ilToolbar: TImageList

View File

@ -59,6 +59,9 @@ type
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
procedure vstAccountsDblClick(Sender: TObject);
procedure vstAccountsFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure vstAccountsGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
var HintText: String);
procedure vstAccountsGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
@ -71,6 +74,8 @@ type
procedure OnDeleteUserResponse(ABuffer: TEnhancedMemoryStream);
procedure OnListUsersPacket(ABuffer: TEnhancedMemoryStream);
function FindNode(AUsername: string): PVirtualNode;
private
procedure OnListModified;
end;
var
@ -276,6 +281,20 @@ begin
if accountInfo^.Regions <> nil then FreeAndNil(accountInfo^.Regions);
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;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
@ -360,6 +379,7 @@ begin
regions := ABuffer.ReadByte;
for i := 0 to regions - 1 do
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
OnListModified;
Messagedlg('Success', Format('The user "%s" has been added.', [username]),
mtInformation, [mbOK], 0);
@ -375,6 +395,7 @@ begin
regions := ABuffer.ReadByte;
for i := 0 to regions - 1 do
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
OnListModified;
Messagedlg('Success', Format('The user "%s" has been modified.', [username]),
mtInformation, [mbOK], 0);
@ -401,6 +422,8 @@ begin
if node <> nil then
begin
vstAccounts.DeleteNode(node);
OnListModified;
Messagedlg('Success', Format('The user "%s" has been deleted.', [username]),
mtInformation, [mbOK], 0);
end;
@ -433,6 +456,7 @@ begin
accountInfo^.Regions.Add(ABuffer.ReadStringNull);
end;
vstAccounts.EndUpdate;
OnListModified;
end;
function TfrmAccountControl.FindNode(AUsername: string): PVirtualNode;
@ -451,6 +475,11 @@ begin
end;
end;
procedure TfrmAccountControl.OnListModified;
begin
vstAccounts.Header.SortColumn := -1;
end;
initialization
{$I UfrmAccountControl.lrs}