Combo box question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Combo box question

Post by DavJans » Thu Mar 17, 2016 4:28 pm

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
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Combo box question

Post by dunbarx » Thu Mar 17, 2016 5:00 pm

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

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Combo box question

Post by DavJans » Thu Mar 17, 2016 5:27 pm

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.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Combo box question

Post by DavJans » Thu Mar 17, 2016 5:31 pm

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?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Combo box question

Post by dunbarx » Thu Mar 17, 2016 6:10 pm

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

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Combo box question

Post by DavJans » Thu Mar 17, 2016 7:00 pm

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.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Post Reply