Hello,
I’m working with v3.10/1 gdk on win2K.
I have a simple class thats I want to generate signals that can be connected to TGProgressBar methods. The TGProgressBar::Connect() calls return kTRUE, but my TQObject::Emit() calls do nothing - TQObject::GetListOfClassSignals() returns 0 and TQObject::fListOfSignals is 0. What am I doing wrong here???
Here’s my class definition:#include <TQObject.h>
class CGuiUpdate : public TQObject
{
public:
static CGuiUpdate *GetInstance();
void SetProgressRange(Float_t lo,Float_t hi); // *SIGNAL*
void SetProgressValue(Int_t value); // *SIGNAL*
private:
static CGuiUpdate *fInstance;
CGuiUpdate();
};
and the implementation
#include <TSystem.h>
#include "CGuiUpdate.h"
CGuiUpdate *CGuiUpdate::fInstance=0;
//ClassImp(CGuiUpdate)
//_____________________________________________________________________________
CGuiUpdate::CGuiUpdate()
{
fInstance = this;
}
//_____________________________________________________________________________
CGuiUpdate *CGuiUpdate::GetInstance()
{
if (fInstance) return fInstance;
return new CGuiUpdate();
}
//_____________________________________________________________________________
void CGuiUpdate::SetProgressRange(Float_t lo,Float_t hi)
{
Long_t args[2];
args[0] = (Long_t)lo;
args[1] = (Long_t)hi;
Emit("SetProgressRange(Float_t,Float_t)",args);
}
//_____________________________________________________________________________
void CGuiUpdate::SetProgressValue(Int_t value)
{
Float_t fVal = (Float_t)value;
Emit("SetProssValue(Float_t)",fVal);
gSystem->ProcessEvents();
}
Here’s the code that connects to the TGProgressBar:[code] TGCompositeFrame *part = fStatusBar->GetBarPart(1);
fProgress = new TGHProgressBar(part,300);
fProgress->SetBarColor(“red”);
fProgress->SetBackgroundColor(GetBackground());
part->AddFrame(fProgress,new TGLayoutHints(kLHintsExpandX,2,2,2,2));
CGuiUpdate *pUp = CGuiUpdate::GetInstance();
fProgress->Connect("SetRange(Float_t,Float_t)","CGuiUpdate",pUp,"SetProgressRange(Float_t,Float_t)");
fProgress->Connect("SetValue(Float_t)","CGuiUpdate",pUp,"SetProgressValue(Float_t)");
[/code]
I build the dictionary using makecint passing the above .h file and including the line “#pragma link C++ class CGuiUpdate;” in the linkdef.h file. Thanks…
Ed