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 next 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
Re: How to create a non modal dialog [message #2567 is a reply to message #2548] Tue, 18 April 2006 00:25 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Have you tried my "catch if you can..." example it this section? I created it with help in mind.
And I think you can develop your help as a separate application and then to merge them. Just my thinking...
Previous Topic: OptionImage ctrl: how to make it better...
Next Topic: How to use callbacks with "embedded" controls...
Goto Forum:
  


Current Time: Thu Apr 25 17:31:59 CEST 2024

Total time taken to generate the page: 0.02693 seconds