is there a way in VC4 to close an open dropdown by clicking anywhere outside the dropdown?
If so, how can I reliably switch the focus to trigger the close?
I tried using Input → Cancel → Lost Focus (Input). This does not work for me.
I also tried different buttons with actions. One with the action “focus dependent” and the other one with “control dependent”. Both with the target to close the DropDown window.
i did not used VC4 for long time, but i made some reminding tests…
If a DropDown is open it locks the whole Displayarea to prevent other inputs. So even if there is a Klick on another Input next to the DropDown, this klick will be ignored. I think this is the main issue why you are asking about how to close the Window in first place.
So why is there this Focus-Lost option there. UseCase StatusDatapoint
For a Test i added a StatusDataPoint to two Elements.
With the Bit 2 on the “StpInput” you can force the Focus to switch over to the input.
If this is set, the DropDown will close.
Hi @Christian_Franzl ,
I asked AI and it suggested the “The Transparent Overlay Method”:
This is the standard approach to force a close event when a user clicks anywhere else on the screen.
Create a Transparent Button: Add a large, transparent button (no border, no background) to your page or background layer.
Layering: Set its Z-order so it sits directly behind the open dropdown but in front of all other page elements.
Visibility Logic:
Bind the button’s Visibility property to the same bit or datapoint that tracks if the dropdown is open.
When the dropdown opens, the transparent button should become visible, covering the rest of the screen.
Close Action: Assign a “Set Datapoint” action to this button. When clicked, it should set the dropdown’s control bit to 0 (closed) and hide itself.
it should work, but I hope you don’t have too many dropdown objs in your visualization.
I hope it helps
Ciao
Valerio
Nice try of the AI it sounded very promissing, it may be possible that it worked at some time. I have used AS4.12.9 and VC4 4.73.3 on ARJ4.93.
Even if the button gets visible after the DropDown was opend. the DropDown locks still all area around. I have used Hot-Spot behind and infront of DropDown. If DropDown was open you can’t click on the Button, the z-order seemed to be irrelevant.
Just a heads up:
I used that transparent layer logic in the past to create message boxes with blocking of clicking of items behind it and optionally the possibility to close the dialog - just the same way as outlined.
BUT: don’t use a big button but a hotspot!