script of "transcript dictionary" stadk
Jeanne A. E. DeVoto
jeanne at runrev.com
Sun Feb 10 03:01:01 EST 2002
At 10:41 AM -0800 2/9/2002, yves COPPE wrote:
>In the "revolution documentation" stack, when you click on transcript
>language, you come on the "transcript language dictionary" page.
>There you have n option popup btn, a fld and below this fld a scrolling fld.
>I'd like to know (for a stack of mine) the script of the fld in which
>we may type in, with the two options
>- scroll to
>or
>filter (of the popUp btn near him).
>
>I've tried to edit this stack to access the script but I cannot.
You should be able to get to this script using the contextual menu shortcut
(command-control-shift-click the field). You might first need to turn on
the option "Contextual menus work in Revolution windows" in the Preferences.
Also you can always type "edit script of the mousecontrol" into the message
box, move the pointer over the object, then press Return.
In case you still cannot get to it, here is the script:
local lTimerID -- variable holding the message ID of the delayed
revDocsFilterTerms message
on rawKeyUp
if the label of button "Filter Type" is "Scroll to:" then
lock screen
if me is empty then -- scroll back to top
set the hilitedLines of field "List" to 1
else -- scroll to first term matching what's typed at its start
put lineOffset(return & me, field "List") + 1 into currentLine
if currentLine > 1 then -- typed field matches a line
set the hilitedLines of field "List" to currentLine
set the scroll of field "List" to \
(currentLine - 1) * the effective textHeight of field "List"
end if
end if
unlock screen
else -- "Filter with:"
if me is empty then -- show all terms
if "revDocsFilterTerms" is in the pendingMessages then cancel lTimerID
set the htmlText of field "List" to the completeHtmlContents of field
"List"
else
if "revDocsFilterTerms" is not in the pendingMessages then
send "revDocsFilterTerms" to me in 200 milliseconds
put the result into lTimerID
else
cancel lTimerID
send "revDocsFilterTerms" to me in 200 milliseconds
put the result into lTimerID
end if
end if
set the hilitedLines of field "List" to 1
end if
end rawKeyUp
on returnInField
if the hilitedLines of field "List" is empty then set the hilitedLines of
field "List" to 1
send "mouseDown" to field "List"
end returnInField
on enterInField
returnInField
end enterInField
on revDocsFilterTerms
lock screen
lock messages
set the htmlText of field "List" to the completeHtmlContents of field "List"
put the text of field "List" into tPlainLines
put the text of me into textToFilterOn
filter field "List" with "*" & the text of me & "*"
set the wholeMatches to true
repeat for each line thisLine in field "List"
if textToFilterOn is not in word 1 to -2 of thisLine then next repeat
put line lineOffset(thisLine,tPlainLines) of the completeHtmlContents
of field "List" \
& return after filteredListOfTerms
end repeat
replace (return & return) with return in filteredListOfTerms
set the htmlText of field "list" to filteredListOfTerms
if line 1 of field "List" is empty then delete line 1 of field "List"
set the hilitedLines of field "List" to 1
unlock screen
unlock messages
end revDocsFilterTerms
--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!
More information about the use-livecode
mailing list