Right click on a text box

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Right click on a text box

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm

by Brendan Doolan >> Thu, 27 Jan 2000 9:40:07 GMT

Hi,
Does anyone know how to prevent the popup menu appearing when you right click on a text box?

Any suggestions gratefully appreciated.

Brendan

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click on a text box

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm

by Kevin Luck >> Fri, 28 Jan 2000 0:56:51 GMT

Most likely you would need to change the code in the textbox mouseUp event (or remove the event completely if all it does is control the pop-up menu). This event logic will include a check to see if it was the right button that was clicked and then will invoke the popupMenu method.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click on a text box

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm

by Brendan Doolan >> Sat, 29 Jan 2000 23:14:46 GMT

Hi Kevin,
This popup is a free feature regardless of having or not having any event code in the text box. It is either supplied by JADE or, more likely, by Windows itself. What I want is a way, probably some windows API, which allows me to disable this freebie.

Thanks, Brendan

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click on a text box

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm

by Frank Pitt >> Mon, 31 Jan 2000 4:16:19 GMT

G'day Brendan
This popup is a free feature regardless of having or not having any event code in the text box. It is either supplied by JADE or, more likely, by Windows itself.

Yep, it's the standard Windows edit pop-up menu.
What I want is a way, probably some windows API, which allows me to disable this freebie

The first question is, have you really thought about why do you want to do this ?
Most cases where people want to change the standard Windows operations come from poorly thought out application design.

If there is a genuine need to do this (and a user requirement is not neccessarily a genuine need, the user may need to be educated in the Windows style guidelines) then what Kevin was saying is how you would deal with it in a normal Windows application.

The problem is that Jade does not give the developer direct access to the Windows event responsible for the mouse-up Jade event, and therefore you can't do it the way a normal Windows programmer would, which is to consume the event, and preventing it from being passed on to the default handler. The mouse-up method is called by that handler, but provides no way of returning a "event handled" code to Windows.

Frankly, without knowing how (or even if) you can get Windows to call you back in a Jade method I can't think of a way of solving this problem. I have some ideas, based on what you do to get around the same limitation in Visual Basic, but I don't know if they'll work

If you have access to MSDN and the time to play, do a search on
"HOWTO: Build a Windows Message Handler with AddressOf in VB"

The reference
"HOWTO: Suppress Default Pop-up Menu When Using Custom Menu"
shows that VB programmers have the same problem though !
This is the sort of reason why people still develop applications in C++ and C <grin>

Oh, if all you want is to prevent it from happening while other processing is going on, disableEvents may help.

_____________________________________
Frank Pitt
Mentor / Consultant
Software Education Associates Ltd
Cnr The Esplanade & Nevis St, Petone
Wellington New Zealand
Voice +64 4 568 7806 Fax +64 4 568 7920
Email frankp@softed.com
Web http://www.softed.com

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Right click on a text box

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm

by Geoff Davies >> Thu, 19 Apr 2001 5:52:00 GMT

In JADE 5.1 there is a new event method on controls and the form called contextMenu. If you simply code 'return false;' in the contextMenu event method for the textbox you can avoid the standard popup menu.

Geoff


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 30 guests