Dropdown Menu won't dropdown

Hi, I’m working on a project with a couple of text fields and a drop down menu. The idea of the project is that an operator scans a bar code and that bar code is inputted into the left text field. The dropdown menu displays a number that is linked to a part number that is displayed in the right text field and by hitting confirm the left and right text fields are compared to determine if they are the same. There’s more to it, but that’s the general concept.

Because the operator needs to scan the bar code first, the left text field has requestFocus() so that when he scans the bar code, the number is inputted into the left text field. The problem though is that the dropdown menu won’t drop down when clicked on, and, correct me if I’m wrong, but I’m assuming this is because the left text field still has focus. Is there a way around this? Give the left text field focus and then take away the focus so that the dropdown menu can be used?

This sounds like Perspective, so I’ll chime in. (Edit: this is Vision, so I will see myself out)

The focus of the Text Field should have no bearing on whether or not you can expand the Dropdown (unless you’re constantly stealing focus from the Dropdown when a user tries to expand the options for display), but let’s get some clarity into the setup. Could you please clarify what container type the Dropdown resides in? Is the Dropdown in a Popup? What version are you using? How are the options AND the value of the Dropdown set/populated? You mention a “confirm” input, but what is that? How does the dropdown interaction work into the logic of these text fields and their comparison?

I’m sorry, I should’ve specified. It’s actually Vision.

The container type is a Main Window (not in a popup). I’m using 8.0. The dropdown values are populated via SQL Query. Not quite sure what you mean by options on that question. The “confirm” input is just a button that the operator presses to confirm the left text field and right text field have the same value. The value in the left text field and the value they select in the dropdown menu are pushed to a table for recording purposes. The dropdown menu contains serial numbers that are linked to part numbers in the right text field (it’s an important component on the project).

After scanning the bar code and inputting that into the left text field, the operator presses a check button that will check if the left text and right text are the same. If they are not, they will be prompted to select a different serial number from the dropdown menu that will then input a different part number into the right text field. Hope this clears some stuff up.

if you dont use the requestFocus() on the first textfield(or anywhere for that matter), does your dropdown work normaly?

Yeah, works perfect without the requestFocus()

how are you applying the request focus?
i seem to only have it when triggering the focus over and over again like @cmallonee said.

so you will have to make sure the script isnt trigger all the time


This is what is on the left text field.

ah yes so it is triggering all the time xd

1 Like

That would explain lol. So is there a way to get around that. Like an if statement that checks if the text field is full and if it is, then take focus away?

sure, just check if the event.source.text is filled in before triggering the request focus xd

you might have to reapply the focus later again tho, like after they are done with that particualr scan have a script somewhere else trigger it again(and be sure to clear the text)

Okay, I’ll try that, thank you!

1 Like