Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » How to create a non modal dialog
How to create a non modal dialog [message #2548] |
Mon, 17 April 2006 13:00 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Now I'm trying to connect my old C callback with the new U++ interface. I hope to not spoil the beauty of the current code with some "spaghetto" .
The next task again deal with a previous topic. I posted the following code for a modal dialog:
#include <CtrlLib/CtrlLib.h>
#define LAYOUTFILE <Vega/editmask.lay> //substitute the path of your layout file
#include <CtrlCore/lay.h>
void testAction()
{ PromptOK("Hello World!");
}
///////////////////////// class //////////////////////
class ButtonOpenDlg : public WithButtonOpen<TopWindow> {
public:
typedef ButtonOpenDlg CLASSNAME;
ButtonOpenDlg();
};
ButtonOpenDlg::ButtonOpenDlg()
{
CtrlLayout(*this, "");
btnOpen.WhenAction = callback(testAction);
}
///////////////////// end class ////////////////////
void OpenDialog()
{ ButtonOpenDlg a;
a.Run();
}
GUI_APP_MAIN
{ TopWindow w;
Button b;
w.Add(b);
b.SetLabel("button - testAction");
b.SetPos(b.PosLeft(200, 250), b.PosTop(100, 30));
b.WhenAction=callback(OpenDialog);
w.Run();
}
//////////////////////// editmask.lay //////////////////
LAYOUT(ButtonOpen, 280, 208)
ITEM(Button, btnOpen, SetLabel(t_("Open Window")).LeftPosZ(92, 96).TopPosZ(88, 24))
END_LAYOUT
I asked for a hint regarding a non modal dialog (modeless?) that permit me to switch between it and the main window without to clode the dialog itself. I was waiting for a simply command but it seems that the task is not immediate. In fact Mirek answered in a way that I was unable to decode
Quote: | Make it a member of your main window class - that way it will not be closed at the and of scope by destructor (you will have to add code for closing it as well).
|
Well, can the previous class dialog transformed in a non modal dialog? and of course, how? I need it to show help files and/or txt and/or qtf document or something else (so they are rather passive window).
Luigi
|
|
|
|
Goto Forum:
Current Time: Thu Apr 25 23:25:16 CEST 2024
Total time taken to generate the page: 0.04801 seconds
|