BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Radio Buttons: Enable/Disable ability to select at runtime

MudratDetector
Enthusiast

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:

MudratDetector_0-1668017193827.png

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.

MudratDetector_1-1668017666610.png

Is the control ID the string ["JHP_UL_AB"] or the other reference [RadioButton_0] from the .grc file?

MudratDetector_2-1668017913968.png

Is the control ID the non-string [UL_AB_Radio] or the other reference [UL_ABID] from the class definition?

MudratDetector_3-1668018077997.png

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
 

Chris Gilmer
Intel i9-12950HX CPU @ 2.30GHz, 16 cores
NVIDIA GeForce RTX 3080
48.0 GB RAM
Windows 10 Pro 64-bit
10 REPLIES 10
MudratDetector
Enthusiast

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

Chris Gilmer
Intel i9-12950HX CPU @ 2.30GHz, 16 cores
NVIDIA GeForce RTX 3080
48.0 GB RAM
Windows 10 Pro 64-bit
Learn and get certified!