Skip to content
Permalink
Browse files

Table editor: root nodes in indexes and foreign key list are defined …

…in BeforePaint event, so repaint these explicitly when table properties have been read. Closes #578.
  • Loading branch information...
ansgarbecker committed Jun 11, 2019
1 parent bda7b93 commit f349ed95830637150dc4614dd6efcfc2cbbb9e02
Showing with 8 additions and 6 deletions.
  1. +8 −6 source/table_editor.pas
@@ -339,6 +339,11 @@ procedure TfrmTableEditor.Init(Obj: TDBObject);
listColumns.RootNodeCount := FColumns.Count;
DeInitializeVTNodes(listColumns);
listColumns.EndUpdate;

// Set root nodes per BeforePaint event:
treeIndexes.Repaint;
listForeignKeys.Repaint;

// Validate controls
comboEngineSelect(comboEngine);
ValidateColumnControls;
@@ -1782,7 +1787,7 @@ procedure TfrmTableEditor.treeIndexesBeforePaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas);
begin
// (Re)paint index list
(Sender as TVirtualStringTree).RootNodeCount := FKeys.Count;
treeIndexes.RootNodeCount := FKeys.Count;
end;


@@ -2146,13 +2151,10 @@ procedure TfrmTableEditor.btnClearForeignKeysClick(Sender: TObject);


procedure TfrmTableEditor.listForeignKeysBeforePaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas);
var
VT: TVirtualStringTree;
begin
// Set RootNodeCount
VT := Sender as TVirtualStringTree;
VT.RootNodeCount := FForeignKeys.Count;
btnClearForeignKeys.Enabled := VT.RootNodeCount > 0;
listForeignKeys.RootNodeCount := FForeignKeys.Count;
btnClearForeignKeys.Enabled := listForeignKeys.RootNodeCount > 0;
end;


0 comments on commit f349ed9

Please sign in to comment.
You can’t perform that action at this time.