Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
forlano is currently offline  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" Laughing .

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 Smile
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
 
Read Message
Read Message
Previous Topic: OptionImage ctrl: how to make it better...
Next Topic: How to use callbacks with "embedded" controls...
Goto Forum:
  


Current Time: Sun May 05 00:12:39 CEST 2024

Total time taken to generate the page: 0.02517 seconds