Re: How to stay on a card when repeating a « find »
André.Bisseret
Andre.Bisseret at inria.fr
Sat Feb 4 12:16:55 EST 2006
Le Saturday, 4 Feb 2006, à 16:59 Europe/Paris, Eric Chatonet a écrit :
>
> YES!
> As you know it the IDE is built with Rev.
> THIS is of great value: it means that you can modify it and first
> study it :-)
> To access all IDE scripts, check the "Contextual menus work in
> Revolution windows" in the General pane of the Preferences.
> Then use a right/control click to open this world :-)
Really GREAT ! I did not know about this possibility !
"Merci beaucoup" Éric for this very useful information.
and also for your idea (and work) about simplifying the function
all the best from Grenoble
André
>
>>> For your convenience:
>>>
>>> function FindNext pDoSelect -- returns a boolean according to a
>>> successful next find
>> Anyway thanks a lot for the function ; I am going to study it before
>> choosing (likely more "pro" than my handler, but it is a bit complex
>> isnt' it ?)
>
> It's very complete but you can simplify it:
>
> local lDidFind,lStartChar
> -----
> function FindNext pDoSelect -- returns a boolean according to a
> successful next find
> local tNotFound,tOffset,tOChar
> -----
> put false into lDidFind
> put true into tNotFound
> -----
> if lStartChar = empty then put 0 into lStartChar
> repeat while tNotFound
> put offset(field "Find", field "Result", lStartChar) into tOffset
> if tOffset is 0 and lStartChar is not 0 then
> put offset(field "Find", field "Result") into tOffset
> if tOffset >= lStartChar then put 0 into tOffset
> put 0 into lStartChar
> beep
> end if
> add tOffset to lStartChar
> if tOffset is 0 or lStartChar is tOChar then return false
> if tOChar is empty then put lStartChar into tOChar
> end repeat
> if pDoSelect then
> select char lStartChar to (lStartChar + the length of field "find"
> - 1) of field "Result"
> end if
> put true into lDidFind
> return true
> end FindNext
>
> Sorry: I forgot the two local script variables in my previous post
> Here field "Result" is the searched field and field "Find" contains
> the string to find.
> And the function is used in a handler as the following:
>
> on MakeMySearch -- mouseUp in a button, etc.
> if not FindNext(true) then beep
> end MakeMySearch
>
> Best Regards from Paris,
> Eric Chatonet
More information about the use-livecode
mailing list