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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refining a Right Click pull down menu 1

Status
Not open for further replies.

FoxEgg

Programmer
Mar 24, 2002
749
AU
I posted a similar enquiry ages ago...

What I would like is a Right Click - Drop down list with various commands... This is like the Drop down lists you get in Excel or Outlook which have a series of options... (Rt Click a cell and down drops a menu)

I got an excellent answer from Ramani

Code:
From Ramani...
In which ever control you want you can add something like this, let us say, in the right click event..
**************************************************
LOCAL lEsc
lESC = SET("ESCAPE")

DEFINE POPUP myPop SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF myPop PROMPT "Delete"
DEFINE BAR 2 OF myPop PROMPT "UnDelete"
ON SELECTION POPUP myPop DEACTIVATE POPUP

ACTIVATE POPUP myPop
DO CASE
   CASE BAR() = 1
      DELETE NEXT 1
   CASE BAR() = 2
      RECALL NEXT 1
ENDCASE
**
RELEASE POPUP myop
SET ESCAPE &lESC
**************************************************

And that was perfect for delete etc... but now I want to have one of the entries do a "copy to clipboard" so I can "paste" it elsewhere.

The right click activated pull down menu with the respective commands would do the job... but how do I do a copy instruction or a paste instruction for that matter.

Is this an API call ?

Thanks

John Fox
 
Use SYS(1500):

Sys(1500, '_MED_CUT', '_MEDIT')
Sys(1500, '_MED_COPY', '_MEDIT')
Sys(1500, '_MED_PASTE', '_MEDIT')
Sys(1500, '_MED_CLEAR', '_MEDIT')
Sys(1500, '_MED_SLCTA', '_MEDIT')

Also, to enable/disable menu options, you can do a check like this:

If Pemstatus(Thisform.ActiveControl, "SelLength", 5) Then
.SetEnabled("_MED_CUT", Thisform.ActiveControl.SelLength > 0)
.SetEnabled("_MED_COPY", Thisform.ActiveControl.SelLength > 0)
.SetEnabled("_MED_CLEAR", Thisform.ActiveControl.SelLength > 0)
Endif

(Do not use the previous code as is, just use the concept, this is taken from an own context menu class)

Also you can check for control ReadOnly property:

If Pemstatus(Thisform.ActiveControl, "ReadOnly", 5) Then
If Thisform.ActiveControl.ReadOnly
.SetEnabled("_MED_CUT", FALSE)
.SetEnabled("_MED_CLEAR", FALSE)
.SetEnabled("_MED_PASTE", FALSE)
Endif
Endif

(Again, the above code will not work as is, outside of its own custom class, use it as an example)

Carlos Alloatti
 
Thanks Carlos..

I will do some reading around this sys(1500).. and see if I can master it.

JF

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top