revHookBuildScriptEditorContextMenu

Peter Haworth pete at lcsql.com
Sat Jun 29 13:34:40 EDT 2013


Hi John,
You're right, that works just fine.  Took me a while to figure out why but
then I noticed that you are setting the ptext parameter, and defining it by
reference whereas I was using the pmodifiedtext parameter by reference
(which seems to be the way the script editor mousedown handler expects
things to work.

Looks like using ptext works because the mouseDown handler uses
pmodifiedtext if its dispatch of revHookBuildScriptEditorContextMenu is
handled and ptext if it's not handled, and I think by passing the message,
it eventually goes nowhere so returns unhandled.

I think there's still a problem though because I'm guessing plugins that
use this feature probably still use pmodifiedtext.  Only time will tell I
suppose.

Anyway, thanks for a clever way to make this work.

So yes, things do seem to work that way but I'm guessing most plugins that
use this feature probably don;t do it that way.

Pete
lcSQL Software <http://www.lcsql.com>


On Sat, Jun 29, 2013 at 12:33 AM, John Craig <john at splash21.com> wrote:

> I just double checked with community 6.0.2 and it works fine.
>
> Set up 2 frontscripts with something like the foloowing code.  Stick a
> slightly different message in each one for identification of which is which.
> When right clicking in the editor, you'll see both customizations are
> there and they both work as expected.
>
> HTH
>
> John.
>
>
>
> on revHookBuildScriptEditorContex**tMenu pObject, pSelectedText, @pText,
> pModifiedText
>    put "Script Editor Customization" & LF & "-" & LF before pText
>    pass revHookBuildScriptEditorContex**tMenu
> end revHookBuildScriptEditorContex**tMenu
>
>
> on revHookScriptEditorContextMenu**Pick pItem
>     if pItem = "Script Editor Customization" then
>       answer "Run your custom code!"
>       exit to top
>    end if
>    pass revHookScriptEditorContextMenu**Pick
> end revHookScriptEditorContextMenu**Pick
>
>
>
>
> On 28/06/2013 22:48, Peter Haworth wrote:
>
>> Hi John,
>> I was hoping that would work too, but it doesn't seem to in my testing.  I
>> set up two front scripts, each with  a handler with a
>> revHookBuildScriptEditorContex**tMenu in it and a pass statement at the
>> end
>> but only one of them was executed.
>>
>>   I think it's because it's not a built-in LC message, just something that
>> is dispatched from the script editor mouseDown handler ,so the first
>> handler to see it is executed then control goes right back to the
>> statement
>> after the dispatch.
>>
>> Same problem occurs with the revHookScriptEditorContextMenu**Pick
>> handling.
>>
>> Hope I'm wrong but don't think so :-)
>>
>> Pete
>> lcSQL Software <http://www.lcsql.com>
>>
>>
>> On Fri, Jun 28, 2013 at 1:24 PM, John Craig <john at splash21.com> wrote:
>>
>>  Hi, Pete.  As long as you pass the message, the other frontscripts will
>>> also receive the message, so you're not limited.
>>>
>>> John.
>>>
>>>
>>>
>>> On 28/06/2013 19:54, Peter Haworth wrote:
>>>
>>>  I would like to use the above to add some items to the script editor
>>>> contextual menu but I see from a recent discussion that only one
>>>> plugin's
>>>> front script will receive the message.
>>>>
>>>> Does anyone have any thoughts on a cooperative architecture that can be
>>>> implemented now to allow multiple plugins to have access to this hook?
>>>>
>>>> Perhaps a custom property of the IDE Home stack (in the uRIP property
>>>> set?)
>>>> that defines the plugin stack name/handler to be invoked by the hook?
>>>>    Would still need a generic front script to trap the hook message and
>>>> call
>>>> the defined plugin handlers.
>>>>
>>>> Pete
>>>> lcSQL Software <http://www.lcsql.com>
>>>> ______________________________****_________________
>>>> 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<http://lists.runrev.com/**mailman/listinfo/use-livecode>
>>>> <**http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>>> >
>>>>
>>>>
>>>>  ______________________________****_________________
>>> 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<http://lists.runrev.com/**mailman/listinfo/use-livecode>
>>> <**http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>> >
>>>
>>>  ______________________________**_________________
>> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>
>>
>
> ______________________________**_________________
> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>



More information about the use-livecode mailing list