04-23-2018 10:11 AM
This appears to be a bug in the radio group library (radioGroup.fp). When converting an existing tree control into a radio group (Radio_ConvertFromTree()), my tree label disappears in run-time.
I tried simply forcing it on with a SetCtrlAttribute(panel, treeCtrl, ATTR_VISIBLE, 1); but this doesn't work. It's as if the attribute is gone after conversion into a radio group?
So I then tried force setting the value and visibility. No go.
Now if I do a GetCtrlAttribute(panel, treeCtrl, ATTR_LABEL_TEXT, title); to see what / if the control even has a title after conversion, I get "Radio". So that's interesting! The library is indeed altering the label title.
So I dug into the library c file (C:\Program Files (x86)\National Instruments\CVI2017\toolslib\custctrl\radioGroup.c) and discovered that it's being thrown a few miles away:
errChk(SetCtrlAttribute (panel, tree, ATTR_LABEL_TOP, -32000));
Why? Who knows. So now I just undo this after I call the conversion function.
04-24-2018 02:01 AM
I suppose the instrument creator assumed you don't want a label to be seen next to the radio group and he moved it away to avoid having the dotted surrounding box when the tree-radio-group is the active control like the one on the left here:
The true fact is, you don't need the Radio Group instrument to have a radio group on screen! Most of the customization the instrument does is already realized when you place a toolbox-radio button control on the panel, with the notable exception of the control label.
So, if you want your radio group to have a label you can simply avoid to convert the tree to radio group (but you'll have to use standard tree control functions to manipulate the group value) or you can restore label position as you are already doing. But you'll have the double highlight as in the control on the right: around the label and around the active item.
On the other hand, if you don't want the group to have a label you'll have to do what the instrument already does to avoid the highlight pattern.