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

UI_RADIOBUTTON ignoring second array index

Denny Wong
Participant

Hi All,

 

I am trying to use UI_RADIOBUTTON with a 2 dimensional array parameter. However if I ask for _param[i][j], it will always store the value in [i][i] instead, making this command useful in the diagonal matrix only.

 

I hope I am not missing something obvious - but this appears to be a bug to me...?

 

Many thanks in advance, I'll love to hear your thoughts.

 

UI_RADIOBUTTON stores values into [2][2], not [2][3] as specifiedUI_RADIOBUTTON stores values into [2][2], not [2][3] as specified

 

Tested in AC23 and AC25, latest patches.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Peter Baksa
Graphisoft
Graphisoft

Yes, this is a bug, thank you for reporting. It will be fixed in the next version (AC26).

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

View solution in original post

11 REPLIES 11

You should use  UI_RADIOBUTTON{2} to be able to use matrix parameters with it.

 

Piotr

Hi Piotr, many thanks for your reply. I thought UI_RADIOBUTTON{2} only take string expression for the parameter and its not taking "someintegers[2][3]" nor someintegers[2][3]. Am I missing something?

 

Thanks in advance.

remove quotes

UI_RADIOBUTTON{2}

Compatibility: introduced in Archicad 20.

UI_RADIOBUTTON{2} "name", value, text, x, y, width, height

Generates a radio button of a radio button group. Radio button groups are defined by the parameter name.
Items in the same group are mutually exclusive.

name: parameter name as string expression for UI_RADIOBUTTON{2} or parameter name with optional actual index values if array for UI_RADIOBUTTON.
value: parameter is set to this value if this radio button is set.
text: this text is displayed beside the radio button.
x, y: the position of the radio control.
width, height: width and height in pixels.

the above comes from:

https://gdl.graphisoft.com/reference-guide/the-user-interface-script

I know it is not clear... but the same aplies to ui_infield's and so on.

Denny Wong
Participant

Thanks Piotr, I am aware of the difference between UI_INFIELD and UI_INFIELD{2} / UI_INFIELD{3} and UI_INFIELD{4}. And from that I am fairly certain that UI_RADIOBUTTON is in fact the right one to use - as it states clearly:

  • parameter name as string expression for UI_RADIOBUTTON{2}
  • or
  • parameter name with optional actual index values if array for UI_RADIOBUTTON

Basically UI_RADIOBUTTON works like UI_INFIELD{2} and UI_RADIOBUTTON{2} works like UI_INFIELD. Very inconsistent but well that's GDL.

 

Just to be very clear what would happen:

Screenshot 2021-09-28 at 13.27.37.pngScreenshot 2021-09-28 at 13.27.20.png

Sorry I did not do a test...it works with original one...

 Parameter is integer

UI_RADIOBUTTON{2} integerArray[1][1], 513, `test Value1`, 10, 140, 100, 20

UI_RADIOBUTTON{2} integerArray[2][2], 1513, `test Value2`, 10, 160, 100, 20

 

 

script.pngparams.png

Denny Wong
Participant

No worries, thanks Piotr. Now if you just quickly try again with integerArray[1][2] and integerArray[2][1], see if you get the correct results?

 

there is some..."consistency" 😛

UI_RADIOBUTTON integerArray[1][1], 513, `test Value11`, 10, 140, 100, 20
UI_RADIOBUTTON integerArray[1][1], 515, `test Value21`, 10, 160, 100, 20

UI_RADIOBUTTON integerArray[1][2], 1515, `test Value12`, 10, 180, 100, 20
UI_RADIOBUTTON integerArray[2][2], 1513, `test Value22`, 10, 200, 100, 20

It seems that it can set column wise.. test this and You will see...

I do not know if it is a bug or feature