void __fastcall TTimelineMainForm::btnLoadClick(TObject *Sender) { TOpenDialog* pOD; pOD = new TOpenDialog(this); pOD->Filter = "Item files (*.itm) |*.itm| All files (*.*)|*.*"; pOD->InitialDir = ExtractFilePath(Application->ExeName); if( pOD->Execute() ) { TimeLine1->BeginUpdate(); for(int i = 0;i<TimeLine1->Items->Count;++i) { if( TimeLine1->Items->Items[i]->Data != NULL ) { delete (pItemData)TimeLine1->Items->Items[i]->Data; TimeLine1->Items->Items[i]->Data = NULL; } } TimeLine1->Items->Clear(); TimeLine1->LoadFromFile(pOD->FileName); TimeLine1->EndUpdate(); } delete pOD; }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = new TOpenDialog(this); pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( sys.m_MsgEng ){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = sys.m_BgnDir; if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); RGFS->ItemIndex = pIniFile->ReadInteger("RADIO", "Offset", 0); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 2)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } delete pBox; }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::LoadBtnClick(TObject *Sender) { // TOpenDialog *pBox = MmttyWd->OpenDialog; pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if(Font->Charset != SHIFTJIS_CHARSET){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; NormalWindow(this); if( pBox->Execute() == TRUE ){ CWaitCursor w; TMemIniFile *pIniFile = new TMemIniFile(pBox->FileName); CmdInit->Text = pIniFile->ReadString("RADIO", "CmdInit", CmdInit->Text); CmdRx->Text = pIniFile->ReadString("RADIO", "CmdRx", CmdRx->Text); CmdTx->Text = pIniFile->ReadString("RADIO", "CmdTx", CmdTx->Text); Cmdxx->Text = pIniFile->ReadString("RADIO", "Cmdxx", Cmdxx->Text); m_PollType = pIniFile->ReadInteger("RADIO", "PollType", 0); FreqOffset->ItemIndex = pIniFile->ReadInteger("RADIO", "PollOffset", 5); PollInt->Text = (pIniFile->ReadInteger("RADIO", "PollInterval", 0) + 5)/10.0; AddrScan->Checked = 0; delete pIniFile; SetMaker(); UpdateUI(); } TopWindow(this); }
void __fastcall BrowseForExecutableT(T * Control, UnicodeString Title, UnicodeString Filter, bool FileNameCommand, bool Escape) { UnicodeString Executable, Program, Params, Dir; Executable = Control->Text; if (FileNameCommand) { ReformatFileNameCommand(Executable); } SplitCommand(Executable, Program, Params, Dir); TOpenDialog * FileDialog = new TOpenDialog(Application); try { if (Escape) { Program = ReplaceStr(Program, L"\\\\", L"\\"); } UnicodeString ExpandedProgram = ExpandEnvironmentVariables(Program); FileDialog->FileName = ExpandedProgram; UnicodeString InitialDir = ExtractFilePath(ExpandedProgram); if (!InitialDir.IsEmpty()) { FileDialog->InitialDir = InitialDir; } FileDialog->Filter = Filter; FileDialog->Title = Title; if (FileDialog->Execute()) { TNotifyEvent PrevOnChange = Control->OnChange; Control->OnChange = NULL; try { // preserve unexpanded file, if the destination has not changed actually if (!CompareFileName(ExpandedProgram, FileDialog->FileName)) { Program = FileDialog->FileName; if (Escape) { Program = ReplaceStr(Program, L"\\", L"\\\\"); } } Control->Text = FormatCommand(Program, Params); } __finally { Control->OnChange = PrevOnChange; } if (Control->OnExit != NULL) { Control->OnExit(Control); } } }
void __fastcall TfmAlertWindowCustomDraw::Open1Click(TObject *Sender) { TOpenDialog *AOpenDialog = new TOpenDialog(this); AOpenDialog->Filter = RTFFilter; if (AOpenDialog->Execute()) { redtMessageText->Clear(); redtMessageText->Lines->LoadFromFile(AOpenDialog->FileName); } delete AOpenDialog; }
//--------------------------------------------------------------------------- void __fastcall TMemoEditFrm::Load1Click(TObject *Sender) { TOpenDialog* pOD; pOD = new TOpenDialog(NULL); try { if( pOD->Execute() ) { reLines->Lines->LoadFromFile(pOD->FileName); } } __finally { delete pOD; } }
void __fastcall TTMTimeLineMainForm::btnLoadClick(TObject *Sender) { TOpenDialog* pOD; pOD = new TOpenDialog(NULL); try { pOD->Filter = "Timeline files|*.tm|All files|*.*"; pOD->DefaultExt = "TM"; if( pOD->Execute() ) { JvTimeLine1->OnReadObject = DoObjectLoad; JvTimeLine1->LoadFromFile(pOD->FileName); } } __finally { delete pOD; } }
//--------------------------------------------------------------------------- void __fastcall TRMenuDialog::SBRefClick(TObject *Sender) { TOpenDialog *pBox = new TOpenDialog(this); pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( MsgEng ){ pBox->Title = "Open command file"; pBox->Filter = "Command files(*.rcm)|*.rcm|"; } else { pBox->Title = "コマンド定義ファイルを開く"; pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|"; } pBox->FileName = ""; pBox->DefaultExt = "rcm"; pBox->InitialDir = BgnDir; if( pBox->Execute() == TRUE ){ ECMD->Text = pBox->FileName.c_str(); } delete pBox; }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::RefBtnClick(TObject *Sender) { TOpenDialog *pBox = new TOpenDialog(this); pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( sys.m_MsgEng ){ pBox->Title = "Program file"; pBox->Filter = "Program files(*.exe;*.lnk)|*.exe;*.lnk|"; } else { pBox->Title = "プログラムファイル"; pBox->Filter = "プログラムファイル(*.exe;*.lnk)|*.exe;*.lnk|"; } pBox->FileName = CmdGNR->Text.c_str(); pBox->DefaultExt = "exe"; char bf[256]; SetDirName(bf, AnsiString(CmdGNR->Text).c_str()); //JA7UDE 0428 pBox->InitialDir = bf; if( pBox->Execute() == TRUE ){ CmdGNR->Text = AnsiString(pBox->FileName).c_str(); //JA7UDE 0428 } delete pBox; }
//--------------------------------------------------------------------------- void __fastcall TRADIOSetDlg::RefBtnClick(TObject *Sender) { TOpenDialog *pBox = Mmsstv->OpenDialog; pBox->Options >> ofCreatePrompt; pBox->Options << ofFileMustExist; if( MsgEng ){ pBox->Title = "Program file"; pBox->Filter = "Program files(*.exe;*.lnk)|*.exe;*.lnk|"; } else { pBox->Title = "プログラムファイル"; pBox->Filter = "プログラムファイル(*.exe;*.lnk)|*.exe;*.lnk|"; } pBox->FileName = CmdGNR->Text.c_str(); pBox->DefaultExt = "exe"; char bf[256]; SetDirName(bf, AnsiString(CmdGNR->Text).c_str()); //ja7ude 0428 pBox->InitialDir = bf; NormalWindow(this); if( pBox->Execute() == TRUE ){ CmdGNR->Text = pBox->FileName.c_str(); } TopWindow(this); }