Graphical user input

Dear root users and developers

I have made myself a small little graphical interface to my analysis, i.e. I have made a TControlBar and added some buttons. One of the buttons says “Select Mass”, and from this button I would like to open an user dialog where the user can type which mass he or she would like to study. The input could be returned as a simple integer and depending on its value the program will open the correct files. I have so far only found examples on code that enables my til open a “file browser” but this is not really what I want since I have to open a selection of files depending on the user input. Do you have any suggestions or examples on how I can sove this?

Thanks for your help and support!

Best regards
Bjarte

Hi Bjarte,

Please find attached an example: run the macro cbar3.C, which in turns will execute the macro dialog.C. The second macro uses ROOT GUI classes that provide a rich set of widgets and make it easy to write attractive applications. You could observe the power of the signals/slots communication mechanism that changes the number of ‘Selected’ label according to the number set in the number entry field. Using the arrows you can change the number or simply you can write it and press Return in the end.

You can read more about ROOT GUI classes at: ftp://root.cern.ch/root/doc/chapter26.pdf

Signals/slots communication mechanism is explained also at: root.cern.ch/root/html/examples/exec3.C.html

Best regards, Ilka

P.S. I forgot to mention the guitest.C example in $ROOTSYS/tutorials
dialog.C (4.25 KB)
cbar3.C (1.08 KB)

Hi IIka!

Thanx for your examples, this was exectly what I needed! I have one question/problem though. If the user enters an invalid mass (there might not be simulation results ready for this mass yet) then I would like to call the set mass panel again. However, when doing that I notice that the dialog “crashes”:

[mohn@solvind ~/MyEventViewAnalysis]$ root -l cbar3.C
root [0]
Processing cbar3.C…
In ShowResults() build the Control Bar
root [1]
The Close button is pressed
Selected Mass = 10
Selected Mass = 10
Error in TQObject::CheckConnectArgs: slot MyDialog::CloseWindow() does not exist
Error in TQObject::CheckConnectArgs: slot MyDialog::DoClose() does not exist
Error in TQObject::CheckConnectArgs: slot MyDialog::DoSetMass() does not exist
Error in TQObject::CheckConnectArgs: slot MyDialog::DoSetMass() does not exist

Do you know why ?

Thanx again!!

Bjarte

Hi Bjarte,

The TControlBar provides only fast access to frequently used operations/macros. The problem you see is known and it is due to the fact that the signals/slots infrastructure is not informed that the interpreted dialog class has been reloaded. The simplest way to avoid that is to create your small application based on the GUI classes and do not use the TControlBar. The new example reproduces the functionality of the previous one, but the dialog can be opened as many times as you want.

Best regards, Ilka
GUIbar.C (7.09 KB)