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

UI Button Double Action?

Lachlan Green
Enthusiast
Ok GDL geniuses, any ideas on this one?

I have set up some buttons in the UI which are to add / subtract 1 from a parameter. Sounds simple. The code itself is very simple (see below or attached object). However it seems to run it twice, each time you click the button, the parameter goes up or down by two not one. If you change the interval to 2, it will go up/down by 4. Unfortunately you can't set the interval to .5 as it rounds it.

A similar function, which relies on buttons, has the same issue. It re-orders the values in an array. It works fine, except again it does it twice, re-ordering the re-ordered array.

Does anyone have some suggestions as to what may be causing this? This is driving me nuts.
unID = 1
button_insert = unID : unID = unID +1
button_delete = unID : unID = unID +1
button_set = unID : unID = unID +1

IF GLOB_UI_BUTTON_ID = button_insert THEN
value = test +1
PARAMETERS test = value
ENDIF

IF GLOB_UI_BUTTON_ID = button_delete THEN
PARAMETERS test = test -1
ENDIF

IF GLOB_UI_BUTTON_ID = button_set THEN
PARAMETERS test = 2
ENDIF
Lachlan Green | Wilson Architects | BIM Manager, Architect
Started on AC9 | Currently AC27 & AC28 | BIMCloud | GDL
Mac Studio (14,13) M2 Max, 64GB, 1TB SSD | MacOS 14.7
2 REPLIES 2
Barry Kelly
Moderator
You should find your solution here ...
http://archicad-talk.graphisoft.com/viewtopic.php?t=48202

The parameter script gets run more than once.

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
Lachlan Green
Enthusiast
Thank you Barry! I can't believe how simple that was!

I had seen that post before when I was trying something different, but I completely forgot about it.

In case anyone else is interested I've attached the fixed object with the bit of code Michael Rensing put up almost 5 years ago!

Thanks again Barry.
Lachlan Green | Wilson Architects | BIM Manager, Architect
Started on AC9 | Currently AC27 & AC28 | BIMCloud | GDL
Mac Studio (14,13) M2 Max, 64GB, 1TB SSD | MacOS 14.7