GUi and shortcut

My code for neutron spectrometry with GUI for the setup parameters and output plots is actually working very nicely, thanks to a few crucial contributions from this forum (thanks a lot). Now I am just fixing a few practical details, which become relevant only if people other than me start using the code.
a) shortcuts: is there a trivial equivalent of Qt’s “setShortcut”? Note that I am not using QT inside ROOT, and actually I am happy with the TG’s. Even the tutorial macro “drag_and_drop.C”, which seems to have shortcuts, doesn’t actually work in that respect (nor I see any shortcut definition in the source code).
b) I am using gTQsender, quite a powerful toy. However, is it possible to set also the ObjectName’s?
c) is it possible to update the statusbar when the mouse is just over a toolbar icon? I managed to update it when clicked ("fStatusBar->SetText(“Exit”), but then it is almost useless in my case

Thank you

Hi Giovanni,

a) shortcuts: Shortcuts are automatically added by adding a ‘&’ in front of the menu (or button) text. For example, fMenuFile->AddEntry(" &Browse…\tCtrl+B", M_FILE_BROWSE); will make a keyboard shortcut.
EDIT Note that in the drag and drop tutorial the shortcut is first “alt+f” then “b” (Ctrl+b is not implemented in the macro)

b) what do you mean by “is it possible to set also the ObjectName’s”?

c) is it possible to update the statusbar when the mouse is just over a toolbar icon?
Probably, I’ll check. But why not simply using a tooltip?

Cheers, Bertrand.

Thank you Bertrand.

a) I tried the AddEntry(" &Exit\tCtrl+W",M_FILE_EXIT)
(the fId works, because it closes everything when I select it on the Menubar).
Still nothing happens, do I need any further includes?
Instead, the “alt+f” then “b” for the drag_and_drop tutorial works fine.

b) Maybe it is just the 3rd argument of TGTextEntry, or the 2nd of AddEntry, the 4th of TGNumberEntry and so on. Possibly I should define a static similar to “gToolBarData”

c) I know, I just wanted something (“Runnind PROGRAM”) showing that the status is busy. Even if I put the “SetText” before the big computation takes place, the statusbar displays the “Running” status only at the end (maybe because the CPU or the graphics are TOO busy?), which is actually the opposite of what I intend it to say.

Hi Giovanni,

a) OK, I see. You have to implement the Ctrl+key shortcuts yourself. See for example how it is done in TRootBrowser (TRootBrowser::HandleKey(Event_t *event))

b) Not sure if this can help, but you can use the static TQObject::Connect() method to connect to a specific class (instead of a specific object)

c) You have to tell gClient to update (redraw) the status bar. Something like:

fStatusBar->SetText(status_text, where); gClient->NeedRedraw(fStatusBar); gSystem->ProcessEvents();
Cheers, Bertrand.

a) Thank you! In fact looking at that “HandleKey” example I got it working
b) is actually solved, gtqsender does exactly what I need, I thought I was actually tricking around, but I was wrong
c) it works, great! Thank you!