Xojo Conferences
XDCMay2019MiamiUSA

Best way to handle contextual menus (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Signing Realbasic Apps for Windows
Next thread: Select Case and case-sensitive strings?


Reading *CSV Files versus *.Txt Files   -   Claude Stone
  Best way to handle contextual menus   -   Brian
   Re: Best way to handle contextual menus   -   Terry Ford
   Re: Best way to handle contextual menus   -   Charles Yeomans

Best way to handle contextual menus
Date: 01.08.08 01:16 (Thu, 31 Jul 2008 20:16:59 -0400 (EDT))
From: Brian
I posted this question yesterday, but I never saw it come to the list, so
I am "re-asking"...

I have a number of edit fields in my application, all of which I would
like the user to be able to right click on and see the basic edit menu
options.

I understand how to do this, but as it stands right now I need to write a
snippet of code on every edit fields MouseClick event to handle this.

I'm curious if there is a "better" way to handle this as a default
behavior in my app. I don't know much about custom controls, but it
sounded like that may be an option??

Or perhaps there is already a solution to this, as it seems like possibly
a fairly standard request?

- Brian

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Best way to handle contextual menus
Date: 01.08.08 01:37 (Thu, 31 Jul 2008 17:37:50 -0700)
From: Terry Ford

On Jul 31, 2008, at 5:16 PM, Brian wrote:

> I posted this question yesterday, but I never saw it come to the
> list, so
> I am "re-asking"...
>
> I have a number of edit fields in my application, all of which I would
> like the user to be able to right click on and see the basic edit menu
> options.
>
> I understand how to do this, but as it stands right now I need to
> write a
> snippet of code on every edit fields MouseClick event to handle this.
>
> I'm curious if there is a "better" way to handle this as a default
> behavior in my app. I don't know much about custom controls, but it
> sounded like that may be an option??
>
> Or perhaps there is already a solution to this, as it seems like
> possibly
> a fairly standard request?

If these editfields are similar, I would make a sub-class of
editfield and place the code to call the contextual menu in that. If
you need separate MouseDown codes in the instances, make an event
definition and raise it in the sub-class. There are some good
examples in the User's guide.

The MenuItem Class would do well for creating the contextual menu to
call the edit menu options.

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Best way to handle contextual menus
Date: 01.08.08 01:40 (Thu, 31 Jul 2008 20:40:10 -0400)
From: Charles Yeomans

On Jul 31, 2008, at 8:16 PM, Brian wrote:

> I posted this question yesterday, but I never saw it come to the
> list, so
> I am "re-asking"...
>
> I have a number of edit fields in my application, all of which I would
> like the user to be able to right click on and see the basic edit menu
> options.
>
> I understand how to do this, but as it stands right now I need to
> write a
> snippet of code on every edit fields MouseClick event to handle this.
>
> I'm curious if there is a "better" way to handle this as a default
> behavior in my app. I don't know much about custom controls, but it
> sounded like that may be an option??
>
> Or perhaps there is already a solution to this, as it seems like
> possibly
> a fairly standard request?
>

I think that the standard way would be to define a subclass of
EditField in which you implement the ConstructContextualMenu and
ContextualMenuAction event handlers. This subclass would then appear
in Window editors -- choose "Project Controls" from that little
PopupMenu above the control list -- and you're there.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>