cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Porting Icon Menu Check

Steve Sunny
Participant

Hi all,

I am porting some legacy Archicad 9 code to Archicad 28/29. In the old code, we used IconMenuCheck like this:

 

 
 
/*\[ 5 ]*/ IconMenuCheck 0 96 33 22 32168 32274 32283 32314 case WETAREAPALETTE: switch (DGPushMenuGetItemIconId(dialID, item, DGPushMenuGetSelected(dialID, item))) { case ); DGSetItemValLong(dialID, item, 0); break;

This worked well because the selected face of the IconMenuCheck effectively became a new clickable button.

In Archicad 28/29:

  • IconMenuCheck still works for showing the popup, but I can’t find a way to retrieve which specific icon was clicked. I only get 0 or 1 (clicked or not).

  • I was advised to replace it with:

 

/*\[ 76 ]*/ UserControl 60 140 50 40 258 1 4 0 2 GICN_BathMenu

 

This shows the popup menu, but the face itself is not clickable. The face changes, but does not behave as a button like before.

Question:
How can I replicate the old IconMenuCheck behavior in Archicad 28/29 — where the changed face itself becomes the active button with its own functionality, not just a passive display?

Any tips, examples, or replacement patterns would be much appreciated!

Thanks in advance.
The new button below

 

SteveSunny_0-1758838563696.png


The old buttons below

 

SteveSunny_1-1758838599063.png

 

2 REPLIES 2
Steve Sunny
Participant

any one 
UserControl is a generic custom control area – it can display dynamic content (e.g. an icon that updates), but it doesn’t inherently handle user interaction (clicks) unless you implement it via callbacks or observers.
so how can implement something like IconMenuCheck  that could display dynamic content (e.g. an icon that updates) and also was clickable. please any one help i am stuck with these for weeks?

Miklos Vegh
Graphisoft
Graphisoft

Hi, this control still exist in Dialog Manager.
You can use the

IconMenuCheck 0 96 33 22 32168 32274 32283 32314

as earlier. 

 

Although it is straightforward to use the C++ API of DG instead of the C API, the C API can still be used as follows:

 

  • GetItemValLong() - The pushed state of the control can be retrieved by this function as earlier.
  • DGPushMenuGetSelected -  gives the index of the selected item as earlier too.
  • DGPushMenuGetIconId is discontinued, there is a new function to retrieve the icon of an item:
  • DGPushMenuGetItemIcon - this retrieves a DG::Icon object instead of an icon identifier. To get the icon id the DG::Icon::GetResourceId() can be used.