- Popup Menus

From: [at]} <Gérard>
Date: Thu, 27 Jul 2006 13:44:43 +0200

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

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

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



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

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBIZWxsbyBSb2JlcnQs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WV3KSBIYW5kbGVDdHJs
TXNnKiAoZjogVmlld3MuRnJhbWU7IFZBUiBtc2c6IFxwYXINCkNvbnRyb2xsZXJzLk1lc3NhZ2U7
IFZBUiBmb2N1czogVmlld3MuVmlldyk7XHBhcg0KICAgICAgXHBhcg0KICAgICAgICBCRUdJTlxw
YXINCiAgICAgICAgICAgIFdJVEhccGFyDQogICAgICAgICAgICAgICAgfG1zZzogQ29udHJvbGxl
cnMuVHJhY2tNc2cgRE9ccGFyDQogICAgICAgICAgICAgICAgICAgIElGIEhvc3RQb3J0cy5yaWdo
dCBJTiBtc2cubW9kaWZpZXJzIFRIRU5ccGFyDQogICAgICAgICAgICAgICAgICAgICAgICBIb3N0
TWVudXMuUG9wdXBNZW51O1xwYXINCiAgICAgICAgICAgICAgICAgICAgRUxTRVxwYXINCiAgICAg
ICAgICAgICAgICAgICAgICAgLi4uXHBhcg0KICAgICAgICAgICAgICAgICAgICBFTkQ7XHBhcg0K
ICAgICAgICAgICAgICAgIC4uLlxwYXINCiAgICAgICAgICAgIEVORDtccGFyDQogICAgICAgIEVO
RCBIYW5kbGVDdHJsTXNnO1xwYXINClxwYXINClRvIG9wZW4gdGhlIHBvcHVwIG1lbnUsIHRoZSBW
aWV3IG11c3QgYmUgaW4gZWRpdCBtb2RlIChmb2N1c3NlZCkuXHBhcg0KXHBhcg0KQ2hlZXJzLlxw
YXINClxwYXINCkdcJ2U5cmFyZFxwYXINClxwYXINCi0tLSBCbGFja0JveFxwYXINCi0tLSBzZW5k
IHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVyb24uY2h9fQBja2Jv
eEBvYmVy


----boundary-LibPST-iamunique-292425665_-_---
Received on Thu Jul 27 2006 - 13:44:43 UTC

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