Move code which lists session names in pulldown from FormCreate to FormShow, so the current session is excluded, not the previous one. Fixes issue #1841.

This commit is contained in:
Ansgar Becker
2010-04-08 23:48:01 +00:00
parent 5f8300e994
commit ddf3b16fd9

View File

@ -156,7 +156,6 @@ const
procedure TfrmTableTools.FormCreate(Sender: TObject); procedure TfrmTableTools.FormCreate(Sender: TObject);
var var
i: Integer; i: Integer;
SessionNames: TStringList;
begin begin
// Restore GUI setup // Restore GUI setup
InheritFont(Font); InheritFont(Font);
@ -185,14 +184,6 @@ begin
comboExportOutputType.Items.Text := OUTPUT_FILE+CRLF +OUTPUT_DIR+CRLF +OUTPUT_CLIPBOARD+CRLF +OUTPUT_DB; comboExportOutputType.Items.Text := OUTPUT_FILE+CRLF +OUTPUT_DIR+CRLF +OUTPUT_CLIPBOARD+CRLF +OUTPUT_DB;
comboExportOutputType.ItemIndex := GetRegValue(REGNAME_EXP_OUTPUT, 0); comboExportOutputType.ItemIndex := GetRegValue(REGNAME_EXP_OUTPUT, 0);
comboExportOutputTarget.Text := ''; comboExportOutputTarget.Text := '';
// Add session names from registry
SessionNames := TStringList.Create;
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
MainReg.GetKeyNames(SessionNames);
for i:=0 to SessionNames.Count-1 do begin
if SessionNames[i] <> Mainform.SessionName then
comboExportOutputType.Items.Add(OUTPUT_SERVER+SessionNames[i]);
end;
// Various // Various
udSkipLargeTables.Position := GetRegValue(REGNAME_TOOLSSKIPMB, udSkipLargeTables.Position); udSkipLargeTables.Position := GetRegValue(REGNAME_TOOLSSKIPMB, udSkipLargeTables.Position);
@ -239,7 +230,8 @@ end;
procedure TfrmTableTools.FormShow(Sender: TObject); procedure TfrmTableTools.FormShow(Sender: TObject);
var var
DBNode, TableNode, FirstChecked: PVirtualNode; DBNode, TableNode, FirstChecked: PVirtualNode;
idx: Integer; idx, i: Integer;
SessionNames: TStringList;
begin begin
// When this form is displayed the second time, databases may be deleted or filtered. // When this form is displayed the second time, databases may be deleted or filtered.
// Also, checked nodes must be unchecked and unchecked nodes may need to be checked. // Also, checked nodes must be unchecked and unchecked nodes may need to be checked.
@ -278,6 +270,19 @@ begin
comboOperation.Items.Text := StringReplace(comboOperation.Items.Text, 'Checksum', 'Checksum ('+STR_NOTSUPPORTED+')', [rfReplaceAll]); comboOperation.Items.Text := StringReplace(comboOperation.Items.Text, 'Checksum', 'Checksum ('+STR_NOTSUPPORTED+')', [rfReplaceAll]);
comboOperation.ItemIndex := idx; comboOperation.ItemIndex := idx;
comboOperation.OnChange(Sender); comboOperation.OnChange(Sender);
// Add session names from registry
for i:=comboExportOutputType.Items.Count-1 downto 0 do begin
if Pos(OUTPUT_SERVER, comboExportOutputType.Items[i]) = 1 then
comboExportOutputType.Items.Delete(i);
end;
SessionNames := TStringList.Create;
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
MainReg.GetKeyNames(SessionNames);
for i:=0 to SessionNames.Count-1 do begin
if SessionNames[i] <> Mainform.SessionName then
comboExportOutputType.Items.Add(OUTPUT_SERVER+SessionNames[i]);
end;
comboExportOutputType.OnChange(Sender); comboExportOutputType.OnChange(Sender);
comboBulkTableEditDatabase.Items.Text := Mainform.Databases.Text; comboBulkTableEditDatabase.Items.Text := Mainform.Databases.Text;