Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blocking default popup menus in tableframes 1

Status
Not open for further replies.

jartman2

MIS
Feb 22, 2003
15
0
0
US
Does anyone know how to block the default right-click popup menus? It only happens in tableframes. We use right-click all over our application, e.g. to jump to other records via key values, and to open files by right-clicking on their filenames via OLE. We see our popup menu first, then the default one appears - during OLE, it appears on top of the other application. Disabledefault has no effect.
 
jartman2,

It sounds like you've added code to something like mouseRightUp to handle your code, which is the right idea, however, you need to generate an error condition to prevent Paradox's default behavior (e.g. displaying the default shortcut menu).

Here's an example, taken from a form's MouseRightUp event, that prevents default shortcut menus for tableframes and any object they contain:

Code:
method mouseRightUp(var eventInfo MouseEvent)

var
   strObjName  String
   uiTarget    uiObject
   loBlockIt   Logical
endVar

   if eventInfo.isPreFilter() then
   ;// This code executes for each object on the form

      eventInfo.getObjectHit( uiTarget )
      strObjName = uiTarget.FullName
      loBlockIt = FALSE

      while strObjName.search( "." ) > 0

         uiTarget.attach( strObjName )
         if uiTarget.class = "TableFrame" then
            loBlockIt = TRUE
            quitLoop
         else
            strObjName = uiTarget.ContainerName
         endIf

      endWhile

      if loBlockIt then
         eventInfo.setErrorCode( userError )
      endIf

   endIf

endMethod

The item that prevents the default shortcut menu is the UserError error code.

Hope this helps...

-- Lance
 
footpad:

It took a while, but I've tried your suggestion and it doesn't appear to have any effect.

I found that I never get any events at the form level with isPrefilter = true. Also, even when I have a method defined for an event, I still get the event back at the form (later) with isPrefilter = false (I thought this wasn't supposed to happen?).

I then thought that maybe the prefilter mechanism wasn't working because of Application Frameworks, so I put the error code into the application event prefilterMouseRightUpBefore(). I do get this event, but it happens after the default popup appears! What can I do?
 
I finally figured this one out yesterday...

In Applications Framework, there is a configuration key in AppProp.db called "App Show Right Click Menu". This must be set to false, _AND_ the code described above must also be in place, to prevent the default popup menu.

You still get the default right-click popup menu on any field for which you haven't entered the UserError code.

- John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top