cerca3

 

--CERCA3 RICERCA testo e conta ritrovamenti tasto ATTIVA
--conta numero righe campo contenente record da analizzare
--uso di IF multipli
on mousedown
  put 0 into trovato
  set visible of msg to false
  put "" into cd fld 2
  put "" into cd fld 3
  ask scrivi_parola_da_cercare
  put it into parola
  put 1 into b
  put 0 into n
  put "" into limite
  put 100 into massimo
  repeat with a=1 to massimo
    get line a of cd fld 1
    if it = limite then exit repeat
    add 1 to n
  end repeat
  put "record presenti= " & n
  REPEAT with a=1 to n
    get line a of cd fld 1
    put it into testo
    if testo=parola then 
      set textcolor of cd fld 1 to 30
      put testo into line a of cd fld 1 
      add 1 to b
      add 1 to trovato
      set textcolor of cd fld 2 to 22
      set textstyle of cd fld 3 to "bold"
      put testo into line b of cd fld 3
      put "linea=" & a into line b of cd fld 2      
    end if
    set textcolor of cd fld 1 to 14
  end repeat
  put "ritrovamenti testo = " & trovato  
end mousedown