Hi
I’m working with a project and have encountered a bit of a roadblock. This is not as much a technical problem as most of the threads here, but I hope that is ok.
One part of the project is an object keeping track of a list of properties, something that can be represented in a GUI as a filled grid of buttons. The length of the list/dimensions of the grid is determined at runtime. Each button can trigger a function targeting the equivalent point in the list.
There are 2 problems linked to this I’m struggling with. I have barely any experience with ROOT, so the answer may be trivial.
1 )
Because I have a list of buttons to be displayed in a grid, the natural choice seems to be using TGMatrixLayout. I do however don’t understand how that class is supposed to be ‘added’ to a button group (my interpretation of what it is supposed to do). It seems to be closely linked to, but not interchangeable with, TGLayoutHints. Neither is it an independent ‘frame bundle’ capable of containing buttons. None of the GUI tutorial examples had anything on it, and I found nothing searching. So how is it used?
An alternative I can see to make a m*n button grid is to make a TGVerticalFrame hosting m TGHButtonGroups, each containing n TGTextButtons. The downside of this is a more complicated structure and build (like loops in loops) and having several groups of buttons seems to cause a slight fragmentation of identifiers, something bringing us to:
2 )
The ROOTUserGuide mentions that each button in a TGButtonGroup has a unique ID (I think you could also do it without a group, but the description seems to point to it being more difficult). My question is then how do you translate/transfer a unique ID of a button being activated to a function getting the coordinate (the equivalent spot on the list)? If there was a known number of buttons you could make just as many buttons, but that is not an alternative here.
From experiments the Connect(myButton, "Clicked()","TH1",hist, "Draw(="MyVar")");
, syntax (the “Draw(=“MyVar”)” part) meant to use MyVar as an input in Draw, don’t seem to work. What other ways do you have to do something like this?
Thanks in advance.