Usage of ComboBox in Forms


Some times there is a need for a field that is displayed in a Form to take some distinct values. The field itself is of type String. Into the Form the type must be defined as Combo. In AutoScript the the approach is as follows:

proc Form_Start()

  call CbLoad("FIELD_NAME", "VALUE1", "VALUE2", "VALUE3")

end

In cases those values come from a database, then:

proc Form_Start()

   start_sql "*" "KOSMOS"
    
SELECT LVALUE FROM LIST_VAL
  
end_sql
  
q = QueryByName()
  
call TExecute(q)
  
count = TRecordCount(q)
  
for i = 1 to count
       
val = TGetFld(q,"LVALUE")

       
call CbLoad("FIELD_NAME",val)

       
call TNext(q)
  
next
  
call FreeEmbSQL(q)

end