TGPictureButton Not connected


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
_Platform:SL7
Compiler: Not Provided


Hello,

I am developing a ROOT GUI in a unique software environment for my experiment. I want to build a TGPictureButton for an event display which will allow navigation between events. I have a class called NavUtil which has functions Next() and Prev(). I have two images (basic arrows) which I want on the buttons and have attached these (no errors there, I think). I am now trying to connect the function to the buttons and I get this error:

FatalRootError: BEGIN
@SUB=TQObject::CheckConnectArgs
slot Prev() does not exist.

The button is connected in my code via this line in my top level main function (seperate file from NavUtil.cc) :

b->Connect(“Clicked()”, “NavUtil”, util, "Prev());

where util is an object of type NavUtil. Prev is definitely a function within NavUtil and the header file for that NavUtil is included in this main file. Have I missed something?

Any help appreciated.
Thank You

You have to create a dictionary for your NavUtil class

Thank you for your response. Do you mean a seperate file with some sort of lookup table? I have a class.xml and class.h file which list all my classes already. These are just lists of classes. What other type of dictionary would I need?

thanks

You need the following:

Add this line at the end of your class definition (in the header file):

   ClassDef(NavUtil, 0)

Then you need a Lindef.h file containing the following lines:

#ifdef __CINT__

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

#pragma link C++ class NavUtil+;

#endif

Then generate the dictionary for your class:

rootcint -f NavUtilDict.cxx -c NavUtil.h Linkdef.h

And add NavUtilDict.cxx in the list of source files of your project (in your makefile)

See also Interacting with Shared Libraries: rootcling

Hi,

I figured the way to do this in our framework but I now have an issue with a “Warning: Unused class rule : EventDisplay::NavUtil”.

The class is defined within a .h and .xml file as is the case with our framework and I have included a ClassDef in my header files now:

class NavUtil : public TObject {
#ifndef CINT
public:
#endif
explicit NavUtil();
#ifndef CINT
void PrevEvent();
.
.
virtual ~NavUtil(){}
#endif
ClassDef(NavUtil, 0);
};
#endif

Sorry, but I don’t understand what you’re trying to do with those #ifndef CINT… And did you generate a dictionary for your class?

No I don’t know how to generate the dictionary in the code framework. We use scons and so as far as I see in other files in our framework all you need to do is include these types of ifndef statements and the ClassDef with a statement “helper.classDef(True)” in the SConscript and genrelfex should take care of that…I am no expert, I could have completely missed the mark there…

I dont know which parts of the code should be between the #ifndef CINT#endif . I based this on a working example in our framework…it maybe wrong

So I’m afraid I can’t help there. You should ask someone who knows your framework and who could help