"In Button" search

Nic Prioleau nickp at didata.bw
Mon May 7 06:47:33 EDT 2007


I have a combobox that contains a list of registration numbers and what I would like to achieve is to be able to start typing the first couple of characters of the reg no in the combo box and have a script that searches within the button and does a kind of live search and take me to the correct place in the button. I have something semi working but it doesn't quite do what I want. Can anyone suggest a better way of doing this?

B401DGS
B423ASD
B434ACK
B435GHP
B512AGF

on keydown whichkey
  put the text of btn "regNo" into temp
  put whichKey after search
  
  if the number of characters in search > 1 then
    filter temp with (search&"*")
**** The following code is not ideal as it sets the line number to the first regNo it finds. If I type "B43" it will takes B434ACK
    set the wholeMatches to true
    put lineoffset(temp, btn "regNo") into tnum
    if tnum > 0 then
      set the menuHistory of btn "regNo" to tnum
    end if
    
  end if
end keydown

Regards
Nic
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################



More information about the use-livecode mailing list