Search field

Jan 29, 2024

I want to enable the user to enter a value and have that stored in a variable. This is made easy with the data entry object. However, it seems very inflexible in its implementation.

I want the user to click on a magnifying glass to make a search box appear. Under the search box is a SEARCH and a CANCEL button. If the user clicks SEARCH, the variable is populated, but if they hit CANCEL, it is not.

I put the search box and buttons in their own layer. When the user clicks the magnifying glass, the layer containing the search box and buttons appears.

However, the data entry box insists upon updating its variable when it loses focus come hell or high water. This makes so I can't hit CANCEL to hide the layer and not change the variable. It's going to change its variable whether I like it or not apparently.

How do I allow the user to enter a value in a data entry box and then NOT update its variable when it loses focus (i.e. if the user hits CANCEL)?

Here is what I tried which did not work:

I created my own variable which I will use in subsequent slides instead of the data entry box's variable. Clicking the SEARCH button will then copy the data entry variable's contents to my variable, and the CANCEL button will not. 

But this isn't working. The trigger that updates my variable isn't doing so.  WTF??

Example attached.

4 Replies
Walt Hamilton

In the original, on the base, SearchTerm is set to txtSearch1 when ttSearch1 changes if userClickedSearch has changed from false to true. But look at the layer.  txtSearch1 changes when txtSearch 1 (don't blame me if those names are confusing) loses focus, which it does when the mouse goes down on btnSearch.  userClickedSearch value is changed to true when the mouse goes upafter going down (the default definition of clicking an object). So the search variable changes before the system recognizes that the search button has been clicked, and the condition is never fulfilled.