Browse Source

GUI: cosmetic improvements

Herman Schoenfeld 7 years ago
parent
commit
39b6ce55a8

+ 21 - 12
src/gui/UCTRLWallet.pas

@@ -147,7 +147,7 @@ begin
     CT_VISUALGRID_DEFAULT, // Payload
     CT_VISUALGRID_DEFAULT, // Payload
     80,                    // OPHASH
     80,                    // OPHASH
     CT_VISUALGRID_STRETCH  // Description (stretch)
     CT_VISUALGRID_STRETCH  // Description (stretch)
-    );
+  );
   FOperationsGrid.OnColumnInitialize := OnOperationsGridColumnInitialize;
   FOperationsGrid.OnColumnInitialize := OnOperationsGridColumnInitialize;
   FOperationsGrid.OnSelection := OnOperationSelected;
   FOperationsGrid.OnSelection := OnOperationSelected;
   FOperationsGrid.PopupMenu := mnuOperationsPopup;
   FOperationsGrid.PopupMenu := mnuOperationsPopup;
@@ -168,13 +168,6 @@ begin
   end;
   end;
   cmbDuration.OnChange := cmbDurationChange;
   cmbDuration.OnChange := cmbDurationChange;
 
 
-  // dock operations grid in panel
-  paOperations.AddControlDockCenter(FOperationsGrid);
-
-  // Configure grid states
-  AccountsMode := wamMyAccounts;
-  OperationsMode := womAllAccounts;
-  OperationsHistory := woh30Days;
 end;
 end;
 
 
 procedure TCTRLWallet.FormResize(Sender: TObject);
 procedure TCTRLWallet.FormResize(Sender: TObject);
@@ -185,7 +178,14 @@ end;
 
 
 procedure TCTRLWallet.ActivateFirstTime;
 procedure TCTRLWallet.ActivateFirstTime;
 begin
 begin
+  // Configure grid states
+  AccountsMode := wamMyAccounts;
+  OperationsMode := womAllAccounts;
+  OperationsHistory := woh30Days;
 
 
+  // Load up selected for some reasons
+  FAccountsGrid.InternalDrawGrid.ClearSelections;
+  FOperationsGrid.InternalDrawGrid.ClearSelections;
 end;
 end;
 
 
 procedure TCTRLWallet.OnAccountsGridColumnInitialize(Sender: TObject;
 procedure TCTRLWallet.OnAccountsGridColumnInitialize(Sender: TObject;
@@ -205,6 +205,7 @@ begin
 end;
 end;
 
 
 procedure TCTRLWallet.SetAccountsMode(AMode: TCTRLWalletAccountsMode);
 procedure TCTRLWallet.SetAccountsMode(AMode: TCTRLWalletAccountsMode);
+var sel1 : TVisualGridSelection; sel2 : TRect;
 begin
 begin
   paAccounts.RemoveAllControls(False);
   paAccounts.RemoveAllControls(False);
   case AMode of
   case AMode of
@@ -213,8 +214,13 @@ begin
       FOperationsGrid.DataSource := FOperationsDataSource;
       FOperationsGrid.DataSource := FOperationsDataSource;
       FAccountsGrid.DataSource := FAccountsDataSource;
       FAccountsGrid.DataSource := FAccountsDataSource;
       FAccountsGrid.Caption.Text := 'My Accounts';
       FAccountsGrid.Caption.Text := 'My Accounts';
+      paAccounts.RemoveAllControls(False);
+      sel1 := FAccountsGrid.Selection;
+      sel2 := FAccountsGrid.InternalDrawGrid.Selection;
+      paAccounts.RemoveAllControls(False);
       paAccounts.AddControlDockCenter(FAccountsGrid);
       paAccounts.AddControlDockCenter(FAccountsGrid);
-      FAccountsGrid.RefreshGrid;
+      paOperations.RemoveAllControls(False);
+      paOperations.AddControlDockCenter(FOperationsGrid);
     end;
     end;
     wamFirstAccount: raise Exception.Create('Not implemented');
     wamFirstAccount: raise Exception.Create('Not implemented');
   end;
   end;
@@ -229,9 +235,7 @@ procedure TCTRLWallet.SetOperationsMode(AMode: TCTRLWalletOperationsMode);
 
 
   function GetAccNo(constref ARow: variant): cardinal; overload;
   function GetAccNo(constref ARow: variant): cardinal; overload;
   begin
   begin
-    if not TAccountComp.AccountTxtNumberToAccountNumber(ARow.Account, Result) then
-      raise Exception.Create(
-        'Internal Error: Unable to parse account number from table row');
+    Result := ARow.__KEY;
   end;
   end;
 
 
 begin
 begin
@@ -305,6 +309,11 @@ begin
         selectedAccounts.Add(acc);
         selectedAccounts.Add(acc);
     end;
     end;
     FOperationsDataSource.Accounts := selectedAccounts.ToArray;
     FOperationsDataSource.Accounts := selectedAccounts.ToArray;
+    FOperationsGrid.Caption.Text:= IIF(
+       ASelection.RowCount = 1,
+       Format('Account: %s', [TAccountComp.AccountNumberToAccountTxtNumber( selectedAccounts[0] )]),
+       'Selected Accounts'
+    ) ;
     FOperationsGrid.RefreshGrid;
     FOperationsGrid.RefreshGrid;
   end
   end
   else
   else

+ 2 - 0
src/libraries/sphere10/UCommon.UI.pas

@@ -151,6 +151,8 @@ begin
     Align := alClient;
     Align := alClient;
     Parent := Self;
     Parent := Self;
     Show;
     Show;
+    if AControl.ClassType.InheritsFrom(TApplicationForm) then
+      TApplicationForm(AControl).Activate;
   end;
   end;
 end;
 end;
 
 

+ 3 - 3
src/libraries/sphere10/UVisualGrid.pas

@@ -369,7 +369,7 @@ type
     property OnFinishedUpdating : TNotifyEvent read FOnFinishedUpdating write FOnFinishedUpdating;
     property OnFinishedUpdating : TNotifyEvent read FOnFinishedUpdating write FOnFinishedUpdating;
 
 
     property WidgetControl: TControl read FWidgetControl write SetWidgetControl;
     property WidgetControl: TControl read FWidgetControl write SetWidgetControl;
-
+    property InternalDrawGrid : TDrawGrid read FDrawGrid;
     procedure RefreshGrid;
     procedure RefreshGrid;
   end;
   end;
 
 
@@ -1821,10 +1821,10 @@ begin
   FPageCountLabel.Caption := Format('/%d',[FPageCount]);
   FPageCountLabel.Caption := Format('/%d',[FPageCount]);
 
 
   if not FFetchDataThreadTimer.Enabled then
   if not FFetchDataThreadTimer.Enabled then
-  if (vgoAutoHidePaging in FOptions) and (FPageCount in [1,2]) and (FPageIndex = 0) then
+  if (vgoAutoHidePaging in FOptions) and (FPageCount in [0,1,2]) and (FPageIndex = 0) then
     case FPageCount of
     case FPageCount of
       // simple situation - just hide bottom panel
       // simple situation - just hide bottom panel
-      1:
+      0,1:
         FBottomPanel.Visible := False;
         FBottomPanel.Visible := False;
       // for PageCount = 2 may be also possible but more complicated especially for AutoPageSize
       // for PageCount = 2 may be also possible but more complicated especially for AutoPageSize
       2:
       2: