GUI user input

Hi,

I have a button that requires text entry in my GUI and I want to type in the name of a histogram and display it on the canvas. How do I make the connection between the buttons and my classes?

Thanks,

Lisa

Hi Lisa,
I suppose you mean title of histogram?
Look how it is done in TH1Editor
root.cern.ch/root/htmldoc/src/TH … nals2Slots

where

another way is to connect not to TGTextEntry::TextChanged signal
but to TGTextEntry::ReturnPressed()

Regards. Valeriy

++
… but … the best way is just reuse TH1Editor class

Hi Lisa,
actually not clear what is the problem.
Could you show a piece of “stoppage” code?

Regards. Valeriy

Hi Valeriy,

Apologies, I didn’t explain myself properly. I have a main frame and a dialog box similar to your DialogExample.C. I want to be able to type in the name of a chain that I want to display in the text entry box and when I press the OK button for that histogram to be displayed on the canvas. What I’m unsure of is how to link the code required to retrieve the histogram to the Ok button.

Thanks,

Lisa

Hi Lisa,

Everytime when OK button released it
invokes TGTextEntry::ReturnPressed method
whcih in turn sends “ReturnPressed” signal.

Regards. Valeriy

Hi Valeriy,

Thank you for the code. I have a few questions if you don’t mind. What type of pointer is entry? And, can you expain the following line, please:

TGTextEntry e = (TGTextEntry)gQTSender;

What is gQTSender?

Thanks,

Lisa

Hi Lisa,
sorry for typo.
Not gQTSenter, but gTQSender

gTQSender is a pointer to object
which sent last signal. It has “void*” type

Since in our case the sender is
always TGTextEntry we can cast
"void*" to “TGTextEntry*”

Regards. Valeriy

Hi Valeriy,

No problem. I am a little confused about the following lines:

fOk->Connect(“Released()”, “TGTextEntry”, entry, “ReturnPressed()”);

entry->Connect(“ReturnPressed()”, 0, 0, “set_name_handler()”);

Is entry a pointer of type TGTextEntry?

Thanks,

Lisa

yes

Just checking! Thanks, Valeriy.