Script editor handler filter [was: Re: Script Editor future]
Charles Warwick
charles at techstrategies.com.au
Tue Aug 25 03:26:20 EDT 2015
> >
> > I expected there might be some issues around that.
> >
> > If it helps, I am happy to send through a list of the changes in
> > textual format via e-mail. I appreciate that is a more manual
> > process from your side, so may not be suitable.
>
> If the stack is shareable feel free to email a zipped copy to me. It'd be a good test case for a stack diff tool I have somewhere on my hard drive….
Thanks for the offer. I kept track of my changes in a text file so that I could re-apply it in later versions if the stack ever changed, so I only needed to tidy them up before posting them here.
Here are the changes:
---
Open ide/Toolset/palettes/revscripteditor.rev in LC.
For an installed copy of LC 7 on Mac, this is in: /Applications/LiveCode 7.x.x/Contents/Tools/Toolset/palettes/
I don’t have Windows, but I assume the directory would be something like: C:/Program Files/Run Rev/LiveCode 7.x.x/Toolset/palettes/
Modify command "update" of button "Handler List" of group "Behaviors"
(In LC8, this behavior is stored in a script only stack in ide/Toolset/palettes/script editor/behaviors/revsehandlerlistbehavior.livecodescript)
After the following code:
if sePrefGet("editor,sortHandlerList") is "alphabetical" then
sort tHandlers by word 2 of each
else if sePrefGet("editor,sortHandlerList") is "order-of-appearence" then
# OK-2008-07-21 : Bug 6805 - Sort the handlers by their line number
sort tHandlers numeric by word 3 of each
else
# OK-2009-03-03 : Bug 7690 - We could change this in the engine, but considering that in the default
# settings we sort alphabetically anyway, it probably doesn't make much difference to just sort here.
# This will produce an ordering F, G, H, PF, PH, S, which may need to be adjusted using a custom search
# function here.
sort tHandlers numeric by handlerTypeSortCallback(word 1 of each)
end if
Add the following lines:
# Filter the list of handlers shown by the contents of the Filter Handler field if it has a value.
if tHandlers is not empty then
if the cApplyFilter of field "Filter Handler" of group "Left Bar" is "true" and field "Filter Handler" of group "Left Bar" is not empty then
put field "Filter Handler" of group "Left Bar" into tFilterHandler
filter tHandlers matching "*" & tFilterHandler & "*"
end if
end if
—
All other changes are performed in the substack “revSETemplate”...
Modify command "resize" of group "Left Bar" of card "Main" of stack "revSETemplate" to be:
command resize
# Ensure the Filter Handler field is displayed above the list of handlers.
set the width of field "Filter Handler" of me to the width of me
set the top of field "Filter Handler" of me to the top of me
set the left of field "Filter Handler" of me to the left of me
set the width of group "Left Handler List" of me to the width of me
set the height of group "Left Handler List" of me to the height of me - the height of field "Filter Handler"
set the top of group "Left Handler List" of me to the bottom of field "Filter Handler" of me
set the left of group "Left Handler List" of me to the left of me
send "resize" to group "Left Handler List" of me
end resize
--
Add a field called "Filter Handler" to group "Left Bar" of card "Main" of stack "revSETemplate" by running the following commands from the message box:
(There is no need to layout the field on the card, as the resize handler above is called when the script editor is opened as well as resized)
create field "Filter Handler" in group "Left Bar" of card "Main" of stack "revSETemplate"
set the dontWrap of field "Filter Handler" of group "Left Bar" of card "Main" of stack "revSETemplate" to false
set the text of field "Filter Handler" of group "Left Bar" of card "Main" of stack "revSETemplate" to "Filter handler list..."
set the textColor of field "Filter Handler" of group "Left Bar" of card "Main" of stack "revSETemplate" to 192,192,192
set the height of field "Filter Handler" of group "Left Bar" of card "Main" of stack "revSETemplate" to 24
edit the script of field "Filter Handler" of group "Left Bar" of card "Main" of stack "revSETemplate"
Add the following to the field's script:
on openField
# If there is no filter currently in the field, set the field to empty.
if the cApplyFilter of me is not "true" then
put empty into me
set the cApplyFilter of me to "true"
set the textcolor of me to black
end if
end openField
on textChanged
send "update" to group "Left Handler List" of group "Left Bar" in 0 milliseconds
end textChanged
on returnInField
select char 1 to -1 of me
end returnInField
on enterInField
select char 1 to -1 of me
end enterInField
on closeField
# If the field is empty, then show the default text and set the cApplyFilter flag to ensure the handler list isn't filtered.
if the text of me is empty then
set the cApplyFilter of me to "false"
put "Filter handler list..." into me
set the textcolor of me to 192,192,192
end if
end closeField
on exitField
# If the field is empty, then show the default text and set the cApplyFilter flag to ensure the handler list isn't filtered.
if the text of me is empty then
set the cApplyFilter of me to "false"
put "Filter handler list..." into me
set the textcolor of me to 192,192,192
end if
end exitField
--
More information about the use-livecode
mailing list