Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

UI_RADIOBUTTON compatibility issue

Sam Karli
Enthusiast
Hi, I ran into a fantastic issue.

In a code running mostly on AC18, I wrote:
UI_RADIOBUTTON "Blabla" someVariable[_i] x, y, w, h
And it ran.

The same code crashed on AC20 citing that I cannot use arrays as parameters driven by UI_RADIOBUTTON.
On AC20 there is a new version: UI_RADIOBUTTON{2}.

But if I write it into the original code, it will crashes on older versions, like on AC18. Even if I ask GDL version with a REQUEST and make a selection for this, it keeps crashing, regardless of the control reaching that part of code.

So there was working stuff that was modified into two nonworking commands.

I devised a workaround of driving a temporary UI parameter from UI_RADIOBUTTON and pass it to the actual (array) parameter I want to drive from UI, but it has its own disadvantages (except for the 4 extra hours of coding I have spent with this problem):

at first I have to initialize the UI vars, like
parameters UIvar = someArray[_i]
and then write back the result
if GLOB_MODPAR_NAME = "UIvar" then
    someArray[_i] = UIvar
    parameters someArray = someArray
endif
The only problem that a code like this is not aware of the real running context and will falsely initialize UIvar to someArray[_i] even if I manipulate the radiobutton. So there must be a selector for initializing UIvar (ot to put it into the else branch of this GLOB_MODPAR_NAME stuff).

But there is still chance of being erroneous, because this piece of code is not aware if UIvar is changed indirectly by another UI element.

So this is not a 100% workaround for this celverly programmed bug.
GDL/Python/C++ dev
4 REPLIES 4
Barry Kelly
Moderator
Sam wrote:
Even if I ask GDL version with a REQUEST and make a selection for this, it keeps crashing, regardless of the control reaching that part of code.
So you are saying that this doesn't work? ...
IF REQ("GDL_version")<=1.806 THEN		! VER 18 and below
    UI_RADIOBUTTON .....
ENDIF

IF REQ("GDL_version")>1.806 THEN		! VER 19 and above
    UI_RADIOBUTTON{2} .....
ENDIF

I use this a lot in my objects although I must admit very rarely in my Interface script.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
runxel
Legend
You guys are doing that for having just one object to take care of?
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Sam Karli
Enthusiast
As far as I know regardless of any kind of selection if there is a UI_RADIOBUTTON{2} in a code AC18 runs, the interpreter print an error that it doesn't know the version 2 of UI_RADIOBUTTON.

Specifically, I REQ-ed somewhere else the GDL_version, put it into a local variable and on the UI script I made the if to that variable's value, but I think it's not a difference.

(PS besides the error message, the UI crashes at that point)
IF REQ("GDL_version")<=1.806 THEN		! VER 18 and below
    UI_RADIOBUTTON .....
ENDIF

IF REQ("GDL_version")>1.806 THEN		! VER 19 and above
    UI_RADIOBUTTON{2} .....
ENDIF

GDL/Python/C++ dev
Daniel Kovacs
Graphisoft Alumni
Graphisoft Alumni
Hey All,

It looks like this change was unintentional, so it is a bug (it can cause incompatibility issues with previously working GDL Library Parts). The UI_RADIOBUTTON command should still work with Array Parameters.

This will be fixed in the next main version (AC22), and we are looking into whether we can fix it in 20 and 21 as well. Thanks for pointing this out to us!

Regards,
Daniel Alexander Kovacs

Professional Services Consultant

GRAPHISOFT



For Troubleshooting and useful Tips & Tricks visit