cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Dialog Box: toggle solid color in image

MudratDetector
Booster

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.

MudratDetector_0-1663857064753.png

 

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.

MudratDetector_1-1663859049607.png

MudratDetector_2-1663859160463.png

MudratDetector_3-1663859189212.png

 

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

MudratDetector_6-1663860039771.png

 

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

MudratDetector_0-1663862559351.png

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>
1>
1>RFIX.WIN\JHP_UL.rc2(12): fatal error RC1015: cannot open include file 'JHP_ULFix.grc.rc2'.
1>
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?

 

Thanks,

Chris

Chris Gilmer
Intel i7-7700K CPU @ 4.20GHz
NVIDIA Quadro M4000
32.0 GB RAM
Windows 10 Pro 64-bit
1 ACCEPTED SOLUTION

Solution
bschwb
Advocate

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"{
	"red_image"
}

 

 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

Bernd Schwarzenbacher
Archicad Add-On Developer
Get (partially free) Add-Ons at www.bschwb.com/add-ons

View solution in original post

2 REPLIES 2

Solution
bschwb
Advocate

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"{
	"red_image"
}

 

 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

Bernd Schwarzenbacher
Archicad Add-On Developer
Get (partially free) Add-Ons at www.bschwb.com/add-ons

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

Chris Gilmer
Intel i7-7700K CPU @ 4.20GHz
NVIDIA Quadro M4000
32.0 GB RAM
Windows 10 Pro 64-bit

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!