Change icon appearence based on a variable
I have these commands that switch some variables on and off in order to draw special things. I would like to have an icon in my custom toolbar for that switch.
Is there a way to tell the CUI to read a variable in Bricscad in order to set the correct .ico image for the toolbar command button? Say a Green icon if the switch is On or a Red one if the switch is Off.
Or maybe i could switch something like the .ico path programatically when the switch is activated?
Could i switch the .ico path in real time and refresh the CUI?
Thanks.
Is there a way to tell the CUI to read a variable in Bricscad in order to set the correct .ico image for the toolbar command button? Say a Green icon if the switch is On or a Red one if the switch is Off.
Or maybe i could switch something like the .ico path programatically when the switch is activated?
Could i switch the .ico path in real time and refresh the CUI?
Thanks.
0
Comments
-
You can use the lisp in the zip file at https://www.theswamp.org/index.php?topic=50447.msg555724#msg555724 to change icons. This may or may not work well for your purpose because there is a delay while the toolbar is recreated.
Bricscad also has a toggle built in if you add a DIESEL command to toolbar button. An example would be $(if,$(=,$(getvar,useri3),17),!.,) . See https://www.bricsys.com/blog/writing-macros-and-diesel-code-customizing-bricscad-r-p9.
I have several toolbars that are 'select one and only one'. Bricscad's operation is not ideal for these since clicking on an icon which is "pressed" will always change that icon to "unpressed". The value returned by evaluating the DIESEL expression is not honored in this case. I haven't found a way to work around this.
0