Hi,
I want to write a small burning gui for cdrdao etc.
at the Beginning of the application I want to scan the scsi bus. But when I start the wxExecute in the OnInit() function, the Programm starts, but I didn't see my dialog.
So I wrote it in the constructor of my dialog. And there it works.
Now the real problem. When the app starts, I check the programm for arguments. When there is no argument, the dialog should appear. When there are some arguments, a mainframe should appear.
I don't want to write the code for scanning the scsi bus twice, for every constructor, the dialog and the mainframe.
I hope somebody can help me.
HeReSY
wxExecute Problem
Ok, here is the main.cpp
There is nothing more in the class. No constructor and an empty destructor.
I've tested a little bit more and, I now I know, that the application is started (it is shown in the task manager), but the dialog didn't appear.
HeReSY
Code: Select all
bool CMainApp::OnInit()
{
wxArrayString output, error;
wxExecute("bin\cdrdao\cdrdao scanbus", output, error);
if(argc == 1)
{
m_pCreateProject = new CCreateProject((wxDialog*)NULL, IDD_CREATEPROJECT);
m_pCreateProject->ShowModal();
SetTopWindow(m_pCreateProject);
return 0;
}
else
wxMessageBox(_("Not implemented yet"),
_("Error starting application"));
return 0;
}
I've tested a little bit more and, I now I know, that the application is started (it is shown in the task manager), but the dialog didn't appear.
HeReSY
-
- Earned a small fee
- Posts: 19
- Joined: Sun Oct 10, 2004 9:20 pm
- Location: Berkshire, England
It's at least suspicious that you call wxDialog::ShowModal() in your OnInit() function. Your OnInit() function won't be resumed until the user closes the dialog there, thus (probably) rendering the SetTopWindow() call almost useless.HeReSY wrote:Code: Select all
bool CMainApp::OnInit() { //... m_pCreateProject->ShowModal(); SetTopWindow(m_pCreateProject); return 0; //... }
You could try and remove the ShowModal() call, maybe replacing it with Show(TRUE). That way execution is resumed right away and your application can use that window as the top-level one.
Good luck!