From: YH Yang on
Dear all

I am testing a simple dialog base app, but encounter some basic problem,
please give me some direction.
I create a top level dialog to process some user configuration info, and
then
use these parameters to create another (child) dialog, and I hope the
original
dialog can be hide after the child dialog showing. The dialogs show/hide
result
is as my expectation, but after the top level dialog hiding, the task icon
in the
taskbar disappears too. Only Ctrl+Tab or taskmanager can find this app.
Did I miss something?

I'm using wxMSW 2.8.2.

simple code as below

class MyConfig : public wxDialog
{
public:
MyConfig(wxWindow *parent, wxWindowID *id = wxID_ANY,
const wxString& title = wxT("Config"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);

private:
wxButton *m_cfg_btn;

private:
void OnConfigButtonClick(wxCommandEvent& event);

DECLARE_EVENT_TABLE();
};

BEGIN_EVENT_TABLE(MyConfig, wxDialog)
EVT_BUTTON(ID_CFG, MyConfig::OnConfigButtonClick)
END_EVENT_TABLE()

MyConfig:MyConfig(wxWindow *parent, wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size,
long style) : wxDialog(parent, id, title, pos, size, style)
{
/* create gui */
}

void OnConfigButtonClick(wxCommandEvent& event)
{
MyAction *actDlg = new MyAction(this);

Hide(); // call this method, app icon disappear from taskbar
actDlg->Show();
}

class MyAction : public wxDialog
{
public:
MyAction(wxWindow *parent, wxWindowID *id = wxID_ANY,
const wxString& title = wxT("Action"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
...
};

MyAction:MyAction(wxWindow *parent, wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size,
long style) : wxDialog(parent, id, title, pos, size, style)
{
/* create gui */
}

class MyApp : public wxApp
{
bool OnInit();
};

bool MyApp::OnInit()
{
MyConfig *cfgDlg = new MyConfig(NULL);
SetTopWindow(cfgDlg);
cfgDlg->Show();
return true;
}
From: Vadim Zeitlin on
On Mon, 21 Apr 2008 03:32:22 +0800 YH Yang <yhuiyang(a)gmail.com> wrote:

YY> I create a top level dialog to process some user configuration info,
YY> and then use these parameters to create another (child) dialog, and I
YY> hope the original dialog can be hide after the child dialog showing.
YY> The dialogs show/hide result is as my expectation, but after the top
YY> level dialog hiding, the task icon in the taskbar disappears too. Only
YY> Ctrl+Tab or taskmanager can find this app.

This probably happens because the child dialog was created with the
original, now hidden, one as the parent and is done by Windows itself and
so is arguably the expected (by the user) behaviour. If you don't want it,
just create the child dialog with wxDIALOG_NO_PARENT style.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

From: YH Yang on
2008/4/21, Vadim Zeitlin <vadim(a)wxwidgets.org>:
>
>
> This probably happens because the child dialog was created with the
> original, now hidden, one as the parent and is done by Windows itself and
> so is arguably the expected (by the user) behaviour. If you don't want it,
> just create the child dialog with wxDIALOG_NO_PARENT style.
>
> Regards,
> VZ
>
>

Hi Vadim, thanks for your explanation.