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  |
 |
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   |
 |
Klugier
Messages: 1099 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 
Sincerely,
Klugier
U++ - one framework to rule them all.
[Updated on: Fri, 27 February 2015 23:25] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:07:12 CEST 2025
Total time taken to generate the page: 0.00775 seconds
|