A gripe about the dictionary (battery life)

Peter Haworth pete at lcsql.com
Fri Jan 3 18:14:22 EST 2014


Better still, use Bjornke's BvG Docu 2 plugin,  much better than the built
in dictionary viewer.

Pete
lcSQL Software
On Jan 3, 2014 12:39 PM, "Geoff Canyon" <gcanyon at gmail.com> wrote:

> I've long been annoyed that LC seems to hover at about 6% CPU use, even
> when in the background. I finally did some investigation, and found out
> something I didn't know: holding down the option (alt) key underlines all
> the links in the dictionary. To accomplish this, the dictionary uses this
> code:
>
> *on* checkForAltKey
>
>    *if* altKey() is "up" and sAltKeyDown is not false  *then*
>
>       *## Alt key has been released*
>
>       *put* false into sAltKeyDown
>
>       entryHideLinks
>
>    *else* *if* altKey() is "down" and sAltKeyDown is not true *then*
>
>       *## Alt key has been pressed*
>
>       *put* true into sAltKeyDown
>
>       entryDisplayLinks
>
>    *end* *if*
>
>    *send* "checkForAltKey" to me in 250 milliseconds
>
> *end* checkForAltKey
>
>
> That's in the script of stack "revDictionary" One way to fix it would be to
> just empty the script to remove the feature.
>
>
> Instead, I made two changes. First, I increased the delay to a second. That
> reduces the CPU to about 2% when the dictionary is in front. Then I added
> suspend and resume handlers, so the altKey script runs only when the
> dictionary is in front. When I'm working with a stack or editing a script
> with the dictionary in the background, load in the dev environment can fall
> to 0%.
>
>
> Here's the resulting script. This is the dev environment, so standard
> disclaimers apply. Be sure to save the dictionary once you make the change.
>
>
> *on* checkForAltKey
>
>    *if* altKey() is "up" and sAltKeyDown is not false  *then*
>
>       *## Alt key has been released*
>
>       *put* false into sAltKeyDown
>
>       entryHideLinks
>
>    *else* *if* altKey() is "down" and sAltKeyDown is not true *then*
>
>       *## Alt key has been pressed*
>
>       *put* true into sAltKeyDown
>
>       entryDisplayLinks
>
>    *end* *if*
>
>    *send* "checkForAltKey" to me in 1 second
>
> *end* checkForAltKey
>
>
> *on* suspendStack
>
>    stopAltKeyCheck
>
> *end* suspendStack
>
>
> *on* resumeStack
>
>    startAltKeyCheck
>
> *end* resumeStack
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list