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 » U++ Library support » U++ Widgets - General questions or Mixed problems » Using a Button to load a window/form using Run. THISBACK syntax
Using a Button to load a window/form using Run. THISBACK syntax [message #44352] Fri, 27 February 2015 22:33 Go to next message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
I'm trying to load a layout with the push of a button.

The layout loads here as expected in GUI_APP_MAIN.
GUI_APP_MAIN
{
	Form1().Run();   // ***** Displays Form 1 perfectly ****
	//Form2Dlg().Run();  // ***** Displays Form 2 perfectly **** <<- Push button control
}


But I can't get the Button coding syntax working. Haven't found THISBACK instructions or example syntax.

Here is my full .CPP code:
#include "Form1.h"

//****** Pasted struct code here, from code generator **********
struct Form2Dlg : WithForm2Layout<TopWindow> {
	typedef Form2Dlg CLASSNAME;
	Form2Dlg();
};

Form2Dlg::Form2Dlg()
{
	CtrlLayout(*this, "Form 2");
}
//------------------------

Form1::Form1()
{
	CtrlLayout(*this, "Form 1");
}
//-----------------
class Form1Dlg : public WithForm1Layout<TopWindow> {
	typedef Form1Dlg CLASSNAME;

	void Btnform2();

public:
	Form1Dlg();
};

Form1Dlg::Form1Dlg()
{
	CtrlLayout(*this, "Form 1");

	btnForm2 <<= THISBACK(Btnform2); // Pushing button to invoke Btnform2 function
}

void Form1Dlg::Btnform2() // Display Form 2 function
{
	Form2Dlg().Run();
}

GUI_APP_MAIN
{
	Form1().Run();   // ***** Displays Form 1 perfectly ****
	//Form2Dlg().Run();  // ***** Displays Form 2 perfectly ****
}


Any guidance appreciated


My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...

[Updated on: Fri, 27 February 2015 22:56]

Report message to a moderator

Re: Using a Button to load a window/form using Run. THISBACK syntax [message #44353 is a reply to message #44352] Fri, 27 February 2015 23:23 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1077
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Edward,

You should create instance of "Form1Dlg" and run it instead of "Form1":
GUI_APP_MAIN
{
	Form1Dlg().Run();   // ***** Displays Form 1 perfectly ****
	//Form2Dlg().Run();  // ***** Displays Form 2 perfectly ****
}


It seems you have unnecessary class "Form1". In this class you didin't define any implementation of "btnForm2" action. So, for me it seems that this is school mistake Wink

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Fri, 27 February 2015 23:25]

Report message to a moderator

Re: Using a Button to load a window/form using Run. THISBACK syntax [message #44354 is a reply to message #44352] Fri, 27 February 2015 23:48 Go to previous message
Edward is currently offline  Edward
Messages: 34
Registered: February 2015
Location: United States
Member
That was it, I had a Form1 Class in the header file, without a reference to the button.
Eliminated the Form1Dlg class.

Thanks

Its been 30 years since school... Sad


My mission is to find a powerful(Non MS) C++ IDE w/GUI to marry and spend the rest of my life with...
Previous Topic: AK example and/or key_source bug?
Next Topic: Creating a hyperlink label
Goto Forum:
  


Current Time: Thu Jul 25 20:30:50 CEST 2024

Total time taken to generate the page: 0.01918 seconds