Page 1 of 1

Working with Combo

Posted: Sun Jan 25, 2015 4:56 pm
by andy60
hi, i'm using combo with a table with 2 fields ('idtype' and 'type'):

Code: Select all

global gConID

on mouseUp
   -- clear combo
   put "" into button "cboFilter"
   -- connect to database
   connectToDb
   --sql
   put "SELECT * FROM tbTypes" into tQuery
   -- execute sql
   put revDataFromQuery(,,gConID,tQuery) into tRecords
   -- handle error
   if tRecords begins with "revdberr" then 
      answer error "There was a problem accessing the people database: " & tRecords
      closeDB gConID
      exit to top
   end if
   -- close db
   closeDB gConID  
   -- insert datas in combo
   put tRecords into button "cboFilter"
end mouseUp
i have 2 questions:
1. how to insert all datas in combo with the only field 'type' visible?
2. how to recover the value of field 'idtype', after event combo 'clicked'?

thx for the help.

Re: Working with Combo

Posted: Sun Jan 25, 2015 6:36 pm
by Klaus
HI Andy,

sorry, do not understand what you are after!?
i'm using combo with a table with 2 fields ('idtype' and 'type'):
Do you mean a "combobox" type (menue) button?
And do you mean Livecode TEXT fields "idtype" etc.?
If yes they are not mentioned in your script.
1. how to insert all datas in combo with the only field 'type' visible?
Sorry, no capisce!?
2. how to recover the value of field 'idtype', after event combo 'clicked'?
Sorry, don't get this either? :(


Best

Klaus

Re: Working with Combo

Posted: Sun Jan 25, 2015 8:04 pm
by andy60
@Klaus

hi Klaus, excuse for my bad english, i post a screenshot. I have a sqlite database with 2 tables: Contacts and Types.
Field idtype in table Contacts has relationship with field idtype in table Types. I'm testing LiveCode and the property of combos.

I want to populate combo with table Type. When i click and select value on combo i want to save in a variable the id of the record without show the id in the combo..

Thx for the help.