We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-11-09 07:32 PM - edited 2022-11-09 10:46 PM
My goal is to gray out or disable the ability to select a radio button at runtime. For example, all of these are non-grayed and selectable:
I suspect this is a TRUE/FALSE or a .IsEnabled/.IsDisabled setting for the individual button based on the control ID and I am already able to determine which ones get which setting. I am also guessing I can loop through the controls collection and apply the predetermined setting to each button as it comes up in the for loop.
What I am not sure of is how to acquire the controls collection and the type or use of the control ID.
Is the control ID the string ["JHP_UL_AB"] or the other reference [RadioButton_0] from the .grc file?
Is the control ID the non-string [UL_AB_Radio] or the other reference [UL_ABID] from the class definition?
I suspect it is the non-string [UL_AB_Radio] since I am able to know which button is selected by using the non-string and provide the corresponding argument to a function that will determine the enable/disable state.
In testing, I am successfully scanning a list of strings that represents the control IDs for each individual radio button and verify the setting with text output to the Report window.
list<std::string> strCategories;
if (argc != "")
{
strCategories = { argc };
}
else
{
strCategories = { "UL_AB", "UL_DEF", "UL_GH", "UL_I", "UL_JK", "UL_LM", "UL_NO", "UL_PQR", "UL_UVW" }; // , "UL_X", "UL_C-AJ-", "UL_F-A-", "UL_F-B-", "UL_F-C-", "UL_W-L-"
}
for (list<std::string>::iterator i = strCategories.begin(); i != strCategories.end(); i++)
{ // determine enable/disable state of each radio button and set accordingly
I am looking for the correct type format to build this list and the proper syntax to apply the enable/disable setting to each button using the list.
Please and thank-you. Have a great day!
Chris
Solved! Go to Solution.
2022-11-15 10:45 PM - edited 2022-11-15 11:12 PM
Yesterday, I was creating the array with button names as strings and stalled at how exactly to use the array. I was looking for something similar to
string arrRadBut[2] = { "UL_AB_Radio", "UL_C_Radio" };
for (int i = 0; i < 2; i++)
{
if (radio_button.Name == arrRadBut[i])
radio_button.Disabled();
}
...but I was not aware of how to get the parent object of radio_button in order to access and modify the properties.
I also was keeping the array with the IDs since I knew the DGDisableItem(32500, arrRadBut[k]); approach was already working. Regardless, the "PanelOpened" dialog never appears by means of the JHP_UL_Dialog::PanelOpened function.
I hope other newbs stumble on to this and find these basics enlightening.
You have been very helpful, yet the search continues...
chris