----boundary-LibPST-iamunique-1317442754_-_-
Content-type: text/plain
Gérard Meunier a écrit :
> Hello Robert,
>> This is something I thought I had done before,
>> but have now completely forgotten how to do it.
>>
>>
>> I have written a View that can be pasted into
>> any Container (although I am probably only
>> interested in a TextView). What I want to do
>> is have a couple of context sensitive specific Commands
>> available in the 'right-click' PopUp Menu when my View
>> selected (or Focussed, but I prefer selected).
>>
>> Can someone advise me how to do this?
>>
> 1) Write a popup menu for your view:
>
> MENU "*" ("MyViews.View")
> "#My:Edit" "E" "MyViews.Edit" "MyViews.EditGuard"
> END
>
> 2) Add these lines in the HandleCtrlMsg procedure of your View:
>
> PROCEDURE (v: View) HandleCtrlMsg* (f: Views.Frame; VAR msg:
> Controllers.Message; VAR focus: Views.View);
> BEGIN
> WITH
> |msg: Controllers.TrackMsg DO
> IF HostPorts.right IN msg.modifiers THEN
> HostMenus.PopupMenu;
> ELSE
> ...
> END;
> ...
> END;
> END HandleCtrlMsg;
>
> To open the popup menu, the View must be in edit mode (focussed).
>
> Cheers.
>
> Gérard
Sorry, but I forgot one step:
3) Add also these lines in the HandleCtrlMsg procedure:
WITH
...
|msg: Controllers.PollOpsMsg DO
msg.type := "MyViews.View";
...
END;
From the docu: The field "type" denotes a context for the focus view.
This context is used to determine which menus are relevant for the focus
view. As a convention, a view assigns the type name of its abstract base
pointer type to type, e.g., "TextViews.View". This convention guarantees
globally unique context names, since module names are considered
globally unique. If the view doesn't support any such context, ignore
this field.
Consequently, there is no need to export "MyViews.View".
Gérard
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-1317442754_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJp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