- Popup Menus

From: Campbell, Robert D (SELEX) (UK Edinburgh) <"Campbell,>
Date: Fri, 28 Jul 2006 08:43:44 +0100

----boundary-LibPST-iamunique-1505099306_-_-
Content-type: text/plain


Thanks Gérard and others, this does exactly what I need.

Now I see the full solution I am sure I have never done this
before, and never would have without help.

Regards

Robert


>> 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

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-1505099306_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBccGFyDQpUaGFua3MgR1wnZTly
YXJkIGFuZCBvdGhlcnMsIHRoaXMgZG9lcyBleGFjdGx5IHdoYXQgSSBuZWVkLlxwYXINClxwYXIN
Ck5vdyBJIHNlZSB0aGUgZnVsbCBzb2x1dGlvbiBJIGFtIHN1cmUgSSBoYXZlIG5ldmVyIGRvbmUg
dGhpc1xwYXINCmJlZm9yZSwgYW5kIG5ldmVyIHdvdWxkIGhhdmUgd2l0aG91dCBoZWxwLlxwYXIN
ClxwYXINClJlZ2FyZHNccGFyDQpccGFyDQpSb2JlcnRccGFyDQpccGFyDQpccGFyDQo+PiBHXCdl
OXJhcmQgTWV1bmllciBhIFwnZTljcml0IDpccGFyDQo+PiA+IEhlbGxvIFJvYmVydCxccGFyDQo+
PiA+PiBUaGlzIGlzIHNvbWV0aGluZyBJIHRob3Vna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Wxs
eVxwYXINClxwYXINCj4+IHVuaXF1ZS4gSWYgdGhlIHZpZXcgZG9lc24ndCBzdXBwb3J0IGFueSBz
dWNoIGNvbnRleHQsIGlnbm9yZVxwYXINClxwYXINCj4+IHRoaXMgZmllbGQuXHBhcg0KPj5ccGFy
DQpccGFyDQo+PiBDb25zZXF1ZW50bHksIHRoZXJlIGlzIG5vIG5lZWQgdG8gZXhwb3J0ICJNeVZp
ZXdzLlZpZXciLlxwYXINCj4+XHBhcg0KXHBhcg0KPj4gR1wnZTlyYXJkXHBhcg0KXHBhcg0KKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKipccGFyDQpUaGlzIGVtYWlsIGFuZCBhbnkgYXR0YWNobWVudHMgYXJlIGNvbmZpZGVu
dGlhbCB0byB0aGUgaW50ZW5kZWRccGFyDQpyZWNpcGllbnQgYW5kIG1heSBhbHNvIGJlIHByaXZp
bGVnZWQuIElmIHlvdSBhcmUgbm90IHRoZSBpbnRlbmRlZFxwYXINCnJlY2lwaWVudCBwbGVhc2Ug
ZGVsZXRlIGl0IGZyb20geW91ciBzeXN0ZW0gYW5kIG5vdGlmeSB0aGUgc2VuZGVyLlxwYXINCllv
dSBzaG91bGQgbm90IGNvcHkgaXQgb3IgdXNlIGl0IGZvciBhbnkgcHVycG9zZSBub3IgZGlzY2xv
c2Ugb3JccGFyDQpkaXN0cmlidXRlIGl0cyBjb250ZW50cyB0byBhbnkgb3RoZXIgcGVyc29uLlxw
YXINCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqXHBhcg0KXHBhcg0KLS0tIEJsYWNrQm94XHBhcg0KLS0tIHNlbmQgc3Vi
amVjdCBIRUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbi5jaH19AGcgTGlzdCkN
Clg

----boundary-LibPST-iamunique-1505099306_-_---
Received on Fri Jul 28 2006 - 09:43:44 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:49 UTC