Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Strange behaviour of my modal dialog
Re: Strange behaviour of my modal dialog [message #2824 is a reply to message #2804] |
Wed, 26 April 2006 18:13   |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I'm sorry to bother the forum once more with the same issue. Unfortunately I can't bypass this stupid problem that stopped me. I feel it is not a bug but the mistake it is not at all evident to me. I've prepared a minimalist example that shows what the problem is. They are 5 files very short. Who is interested can run the package attached (unzip in vegaTest). Here I show each file with the hope that the problem can be fixed on the fly.
File 1, is the *.h with the declaration of the two classes that are used by the program, one of them is a widget:
#include <CtrlLib/CtrlLib.h>
#define LAYOUTFILE <testVega/Vega.lay>
#include <CtrlCore/lay.h>
class NewTournamentDlg : public WithNewTournamentLayout<TopWindow> {
public:
typedef NewTournamentDlg CLASSNAME;
NewTournamentDlg();
~NewTournamentDlg() {;}
};
class RoundData {
public:
String NAMETORNEO;
RoundData();
~RoundData(){;}
};
// maybe the problem is the line below?
class RoundData TD; //is it seen in each *.cpp file? Is it a definition or a declaration?
File 2 is the definition of the method of the above widget. It put (it should put!) in an EditString the value TD.NAMETORNEO that has been set elsewhere:
#include "VegaMain.h"
NewTournamentDlg::NewTournamentDlg()
{ int i, j;
CtrlLayout(*this, "");
editTourn <<= TD.NAMETORNEO;
}
and this is the correspondent .lay file:
LAYOUT(NewTournamentLayout, 268, 92)
ITEM(EditString, editTourn, NotNull(true).LeftPosZ(16, 228).TopPosZ(36, 19))
END_LAYOUT
File 4, define the constructor of the non widget class:
#include "VegaMain.h"
RoundData::RoundData()
{ NAMETORNEO = "my torneo";
}
So "my torneo" is the name with which born an instance of the previous class. And now the last file, main.cpp, where happen strange things:
#include "VegaMain.h"
void NewMask()
{ TD.NAMETORNEO = "luigi";
NewTournamentDlg newt;
newt.Run(); //appear "my torneo"
PromptOK( TD.NAMETORNEO); //appear "luigi"
}
GUI_APP_MAIN
{ TopWindow w;
Button b;
w.Add(b);
b.SetLabel("push me").LeftPos(10, 100).TopPos(10, 30);
b.WhenAction = callback(NewMask);
w.Run();
}
As said in a previous post, after the previous:
TD.NAMETORNEO = "luigi";
I expect to see it inside the editstring of the widget because of its constructor. Instead appear "my torneo". It looks as TD is not seen by newt. How can I do visibile TD to newt? In C I could make TD global, but now?
What I am missing to do?
Thank you,
Luigi
-
Attachment: testVega.rar
(Size: 1.35KB, Downloaded 1610 times)
|
|
|
Goto Forum:
Current Time: Sat Jun 07 01:15:23 CEST 2025
Total time taken to generate the page: 0.04792 seconds
|