Weird GUI connection problem

I am trying to build a standalone program which uses the ROOT GUI classes, but for some reason, I can’t get the TGTextButton to connect its Clicked signal to a specified method. Weirdly though, I get no compilation errors, no runtime error messages about connection error, and a TGComboBox in the same program connects fine via its Selected(Int_t) signal. The actual code is pretty lengthy but the relevant bits are:

gtimaker.h

[code]class gtimaker{

RQ_OBJECT(“gtimaker”)

public :

void DoGetData();
void Unlock();

private :

TGComboBox * runList;
TGTextButton *getDataButton;

void GetData();

ClassDef(gtimaker, 1)
};[/code]

gtimaker_LinkDef.h

[code]#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class gtimaker+;

#endif[/code]

gtimaker.cpp

ClassImp(gtimaker)
...
TGComboBox * runList = new TGComboBox(buttonFrame, "Select Run");
TGTextButton * getDataButton = new TGTextButton(buttonFrame, "Get &Data");
...
// This button needs to be disabled until a selection is made from runList 
getDataButton->SetState(kButtonDisabled);
...
getDataButton->Connect("Clicked()","gtimaker",this,"DoGetData()");
TQObject::Connect(runList,"Selected(Int_t)","gtimaker",this,"Unlock()");
...
void gtimaker::Unlock(){
        std::cout << "Unlock Called!" << std::endl;
	if(histsSet){
		writeButton->SetState(kButtonUp);
		addBadButton->SetState(kButtonUp);
		updateBadButton->SetState(kButtonUp);
		unlocked=true;
	}
	getDataButton->SetState(kButtonUp);
}
...
void gtimaker::DoGetData(){
	std::cout << "DoGetData Called!" << std::endl;
	GetData();
}

As I say, the TGComboBox works fine (“Unlock Called!” is printed and the button is indeed unlocked), so I’m guessing all the compilation has been done correctly.

Does anyone have any ideas?

Cheers,

Hugh
[/code]

Hi Hugh,

I don’t see any obvious issue with the provided piece of code. This should work… Could you try to comment these two lines:

getDataButton->SetState(kButtonDisabled);
...
getDataButton->SetState(kButtonUp);

And let me know, please?

Cheers, Bertrand.

Hi. No luck I’m afraid. For some extra information the gtimaker class is instantiated in main as follows:

int main(int argc, char** argv){ TApplication *theApp = new TApplication("App", &argc, argv); gtimaker *makegti = new gtimaker(); theApp->Run(); return 0; }

It sets up the GUI itself, displays it and is then designed to call its own methods based on signals from the GUI.

The only possible problem might be that the code is compiled with -fPIC. I’m not sure if this would make the slightest difference, but I’m grasping at straws here!

Cheers,

Hugh

Hi,

I’m afraid to not be able to help without a running piece of code demonstrating (reproducing) the problem…
Could you post (or send me) your code?

Cheers, Bertrand.