Detecting change in TGNumberEntryField

Hi,

How can I detect number in TGNumberEntryField changed?
I found the following description in TGNumberEntryField.h, but couldn’t figure out how to access these information.
Enum defining kTE_TEXTCHANGED etc. does not seem to belong to Event_t…

Hi,

You have two options, by calling this method:

YourWidget::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) { switch (GET_MSG(msg)) { case kC_TEXTENTRY: switch (GET_SUBMSG(msg)) { case kTE_TEXTCHANGED: // do whatever you want here break; } break; } }
or by using signal/slots:

Please take a look in the tutorials (e.g. numberEntry.C or guitest.C)

Cheers, Bertrand.

Thank you for your prompt reply.

TGNumberEntry has ValueSet(Long_t) method, but TGNumberEntryField does not seem to have.
Can’t you use the second option for TGNumberEntryField?

Hi,

As TGNumberEntryField inherits from TGTextEntry, you can connect to this signal:

And convert the text to any format you want…

Cheers, Bertrand.

It works fine.
Thank you!