Got a minute? We appreciate your feedback:

Graphisoft Learn survey
Archicad C++ API
About Archicad add-on development using the C++ API.

Dialog Box: toggle solid color in image


Development is currently in Archicad 24:


I would like to have a 8 swatches of color around 4 buttons in a dialog box that I could  toggle between two solid colors [red and the color of the dialog] based on the button click event.



In the ResIDs.hpp file, I have defined the ID.



#define JHP_UL_RED_T		32501




In the .grc file, I have placed the Icon in the dialog.



/* [    ] */ Icon					  20    30  135    35	JHP_UL_RED_T




In my class in the .hpp file, I am currently NOT doing anything with this icon.





I am not doing anything here because nothing was necessary to get another icon to appear in the dialog.



If I try to use this as part of the class, I get


so I keep it commented out for now.


In the Fix.grc file, if I try to set this red [255,0,0]



'GICN'	JHP_UL_RED_T "General Settings"{
	255 0 0





I get a build error



1>RFIX.WIN\JHP_UL.rc2(12): fatal error RC1015: cannot open include file 'JHP_ULFix.grc.rc2'.
1>Done building project "JHP_UL.vcxproj" -- FAILED.




Even if I could set to red in this way, it would be permanent.

Is there a function I could use to set all 8 to the dialog color and then toggle the set that corresponds to the selected button to red [255,0,0]?  Is swapping solid colors like this even possible?  Am I even close to doing this correctly?




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


Hi Chris!

1. I think the syntax in your Fix.grc file doesn't work. You can't specify a color there. You would need to use a file name (withouth the ending) there. Something like this:


'GICN'	JHP_UL_RED_T "General Settings"{


 And then you would need an image called "red_image.png" at the correct place. The correct place depends on how you call the resource compiler in your build process.


2. To show and hide this icon, you will need the item as part of your dialog class. Concerning the error there. Make sure that you uncomment all the instances of the 3 pictures you posted. (Also make sure to make unique indices in the first picture). From the error it seems you uncommented only the line in the last picture. If the error is still there then we probably need more context to debug this.

3. Other options are to setup a drawing context yourself. This is a bit more cumbersome but there's a good example Add-On in the DevKit. Check the example file: "DG_Test/Src/DrawDialogItems.cpp"

Hope this helps,

Bernd Schwarzenbacher - Archicad Add-On Developer - (Add-On Downloads & Articles)

Hello Bernd and happy Monday morning!!


I appreciate the confirmation of what I thought I would have to do.


I was aware of this .png file solution, just hoping to avoid having a specific image of red.  For some reason, I think specifying 255, 0,0 would have been faster, if only possible.  I recall having seen this RGB solution in the documentation or maybe a forum reply - - just could not get it to work...


Thanks again and have a great week.


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

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!