Page 1 of 1

Combo box question

Posted: Thu Mar 17, 2016 4:28 pm
by DavJans
We are using a combo box to list unique job numbers for items that in turn we use to filter items, that way they can see all items for every job if left blank or specific jobs. The drop down works great but if we type a job number in and hit return or enter, I can't get it to work. Here is what I've tried doing.

This works,
on menuPick
send openCard to card "partswindow2"
end menuPick

These do nothing,
on enterKey
send openCard to card "partswindow2"
end enterKey

on returnKey
send openCard to card "partswindow2"
end returnKey

These clears out what was typed, returns the label to what it was, then nothing.
on enterinfield
send openCard to card "partswindow2"
end enterinfield

Re: Combo box question

Posted: Thu Mar 17, 2016 5:00 pm
by dunbarx
Hi.

I assume you mean "combo box" not "option menu".

You need to use "returnInField" and "enterInField", if what I think you are trying to is right. I have no idea what the card script in the target card is up to, but at least the "openCard" message will be sent. Check out the dictionary for the subtle differences between, say, "enterKey" and "enterInField".

Craig Newman

Re: Combo box question

Posted: Thu Mar 17, 2016 5:27 pm
by DavJans
Yes combo Box is what I was asking about,

also I mention that I tried using enterinfield, I tried returninfield as swell but with the same result, all it does is clear out what what typed and and replace the text with what was in there before typing.

Re: Combo box question

Posted: Thu Mar 17, 2016 5:31 pm
by DavJans
I just thought of something, on the card script it looks for the label of the combo box, If I type into the combo box and hit enter does it set the label of itself to what was typed?

Re: Combo box question

Posted: Thu Mar 17, 2016 6:10 pm
by dunbarx
Hi.

Nothing should erase your entry unless you tell it to do so. I do not see this.

And yes, the current label of the combo box will be the visible text. This whether you select from the menuItems, or type and go.

Put this into your openCard handler temporarily:

Code: Select all

on opencard
   put random(999) && the label of btn "yourComboBox"
end opencard
Craig

Re: Combo box question

Posted: Thu Mar 17, 2016 7:00 pm
by DavJans
I found the problem, the open card script was causing it to not function as intended.

as part of opencard i was updating the combo box with this

Code: Select all

   
--Populate filter pcmk dropdown
put "SELECT DISTINCT pcmk FROM partsorders where partsstatus <> 'Delivered' Order BY pcmk" into tSQL
   put revDataFromQuery(comma, cr, gConnectionID, tSQL) into pcmkFilterList
   put "" & cr before pcmkFilterList
   put pcmkFilterList into btn "P Menu"
This was before filtering for the part typed in, the job menu is identical except job instead of pcmk.
my best guess as to why it broke is when typing in something it does not change the 'line item" I'm on using the drop down.
Then when i populate the list again, it replaces the label I typed with the label for the line item i'm on.

I moved this code to the end of the open card script and everything is functioning as intended, thanks for your help.