Convert database tree from TTreeView to TVirtualStringTree.

- Fixes bug #271 "F5 shortcut in database tree not working"
- Fullfills rfe #519 "Highlight selected item in tree view when focus is elsewhere"
- Fixes inconsistent expansion state of nodes after refreshing
- Fixes plus sign staying when a db node with 0 tables was selected
- Slightly enhances painting speed within the dbtree
- Removes temporary storage of a rightclicked node (DBRightClickSelectItem). VirtualTree handles its right clicked selection exactly like the left clicked one, which makes makes coding a bit cleaner as we can always use the selected item instead of hacking with the right and left clicked node. On the other side it removes a quite user friendly feature. Well, we can reimplement this feature later, though it's not user UNfriendly currently.
- Reasonably rename the StringList "OnlyDBs" to "DatabasesWanted" and "OnlyDBs2" to "Databases"
This commit is contained in:
Ansgar Becker
2008-06-13 23:05:51 +00:00
parent c265dd2f94
commit 41074d211e
13 changed files with 597 additions and 807 deletions

View File

@ -89,7 +89,6 @@ type
{ Private declarations }
public
{ Public declarations }
SelectedDatabase : String;
end;
{$I const.inc}
@ -251,7 +250,6 @@ begin
Mainform.ChildWin.ExecUpdateQuery( createQuery, False, True );
Mainform.ChildWin.MenuRefreshClick(sender);
Mainform.ChildWin.SelectedTable := EditTablename.Text;
Mainform.ChildWin.ShowTable(EditTablename.Text);
except on E: THandledSQLError do
// Keep the form open so the user can fix his faulty input
ModalResult := mrNone;
@ -509,23 +507,16 @@ end;
procedure TCreateTableForm.FormShow(Sender: TObject);
var
i : Integer;
tn : TTreeNode;
i: Integer;
begin
// FormShow!
// read dbs and Tables from treeview
DBComboBox.Items.Clear;
for i:=0 to Mainform.ChildWin.DBTree.Items.Count-1 do
begin
tn := Mainform.ChildWin.DBTree.Items[i];
if tn.Level = 1 then
DBComboBox.Items.Add(tn.Text);
end;
DBComboBox.Items.Assign(Mainform.ChildWin.Databases);
// Preselect relevant database in pulldown
if SelectedDatabase <> '' then
DBComboBox.ItemIndex := DBComboBox.Items.IndexOf( SelectedDatabase )
else if DBComboBox.Items.Count > 0 then
DBComboBox.ItemIndex := DBComboBox.Items.IndexOf( Mainform.ChildWin.ActiveDatabase );
if (DBComboBox.ItemIndex = -1) and (DBComboBox.Items.Count > 0) then
DBComboBox.ItemIndex := 0;
if Mainform.ChildWin.mysql_version >= 32300 then