Perspective dropdown deselect

In vision dropdown if I want to reset the dropdown list, I can just set the SelectValue=-1 by scripting, I can also set the no selection data

I don’t knwo how to realize the same function in the perspective dropdown List

Dropdown resest
Set the value to null (which is None in Python). Here the reset button has the code,
self.getSibling("Dropdown").props.value = None

A better solution would be to use sendMessage.
On the button onClick action is

system.perspective.sendMessage("dropdownReset", {}, scope = 'view')

On the dropdown, right-click, Configure Scripts, Message Handlers, Add Handler, set Message Type = 'dropdownReset`, set the Listen Scope to ‘View’ (same as the sendMessage setting above) and add the following code.

self.props.value = None.

sendMessage protects you from breaking the functionality if you move any of the components into containers, etc.

I can also set the no selection data.

The “Select…” text is set in props.placeholder.text.


thanks for your support, but 2 more question,

  1. In vision, my button’s enable can binding to the dropdown’s selected value,like the following picture
    how can this function realize in perspective

2 . In vision I can change the dropdown component’s background and forground color, but how to realize this funtion in perspective?

Did you try ?

I mean…


my dropdown list value is string, so your logic not works

My purpose is when the dropdown is reset to default show orange, if select a value show green.

Well… this is not my logic, it’s the one you showed in your screenshot ! I just reproduced exactly what you were doing.

If your goal is to give something a specific color when nothing is selected in your dropdown, you can use pretty much the same expression, just check if props.value is null, or whatever the default value is. Here I check for null and empty string:



1 Like

this color works , but how to handle when the props.value is null I need disable the botton function?

here is the sender
I need when the prop.value is null
disable the button enable function

Set the enabled property to either true or false.

Exactly the same binding only instead of mapping to a color you map it to a value. false when you want it disabled and true when you want it enabled.

you put a red circle around the meta.tooltip.enable . this disabled the tooltip, not the button
the button is at props.enabled

This property:

Button enable

@Transistor @victordcq @lrose @pascal.fragnoud thanks for all of your support, I just transfer from vision to perspective, a lot of logic have to change