Fix a focus-issue for rightclicking in ListTables. ValidateControls is called by OnClick, but rightclicking doesn't seem to call OnClick. So, add ValidateControls to popupDbGrid.OnPopup.

Also checking the focused node doesn't say if some nodes are selected. A focused node can even be unselected in the way that its background is not highlighted. So, rather check the selection in ValidateControls.
This commit is contained in:
Ansgar Becker
2007-08-26 06:19:34 +00:00
parent f814439f03
commit f67200157b

View File

@ -711,6 +711,8 @@ var
SelectedEngine : String;
NodeData : PVTreeData;
begin
ValidateControls;
if ListTables.SelectedCount <> 1 then
begin
Exit;
@ -2333,7 +2335,7 @@ begin
// not table (now invisibly) selected on the database grid.
if (PageControlMain.ActivePage <> tabDatabase) then ListTables.FocusedNode := nil;
tableSelected := Assigned(ListTables.FocusedNode) and FrmIsFocussed;
tableSelected := (Length(ListTables.GetSortedSelection(False))>0) and FrmIsFocussed;
btnDbProperties.Enabled := tableSelected;
menuproperties.Enabled := tableSelected;
btnDbInsertRecord.Enabled := tableSelected;