Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Antonio Massouh
  Where is Antonio Massouh?
 Campinas
 Brazil
 Antonio Massouh
 Tags
Subject: RE: Context menu on a form
Thread ID: 228699 Message ID: 228746 # Views: 24 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Thursday, May 21, 2009 9:41:32 AM         
   


> Hi Mike !
> Yes, it worked. I just put the code between "PROCEDURE edit1.RightClick" and "ENDPROC" you provided above inside the RightClick Event of the Editbox.
>

Exactly.

> But I want to give the user 3 options in the context menu: Select all text, Copy (or Select and copy all text in just one click) and Print. What are the commands I have to write to fire selection, copy and print ?
>

In order to see how the "Edit" menu pad works, you can create a new menu in the IDE, and then choose "Quick Menu" in the "Menu" menu. Then do a "Generate" so that you'll get an MPR file that contains the code. From there, you can directly copy the desired lines, and modify them so that they belong to your self-defined shortcut menu.

LOCAL oForm as Form
oForm = CREATEOBJECT('TestForm')
oForm.Show(1)
RETURN

DEFINE CLASS TestForm as Form
	AutoCenter = .T.

	ADD OBJECT Edit1 as Editbox WITH ;
		Left = 10, Top = 10, ;
		Width = 350, Height = 220, ;
		Anchor = 15

	PROCEDURE Edit1.RightClick
		DEFINE POPUP sc SHORTCUT RELATIVE FROM MROW(),MCOL()
		DEFINE BAR _med_cut OF sc PROMPT "Cu\<t" ;
			KEY CTRL+X, "Ctrl+X" ;
			PICTRES _med_cut ;
			MESSAGE "Removes the selection and places it onto the Clipboard"
		DEFINE BAR _med_copy OF sc PROMPT "\<Copy" ;
			KEY CTRL+C, "Ctrl+C" ;
			PICTRES _med_copy ;
			MESSAGE "Copies the selection onto the Clipboard"
		DEFINE BAR _med_paste OF sc PROMPT "\<Paste" ;
			KEY CTRL+V, "Ctrl+V" ;
			PICTRES _med_paste ;
			MESSAGE "Pastes the contents of the Clipboard"
		DEFINE BAR _med_sp200 OF sc PROMPT "\-" ;
			PICTRES _med_sp200
		DEFINE BAR _med_slcta OF sc PROMPT "Se\<lect All" ;
			KEY CTRL+A, "Ctrl+A" ;
			PICTRES _med_slcta ;
			MESSAGE "Selects all text or items in the current window"
		ACTIVATE POPUP sc
	ENDPROC
ENDDEFINE



hth
-Stefan

ENTIRE THREAD

Context menu on a form Posted by Antonio Massouh @ 5/20/2009 11:18:35 PM
RE: Context menu on a form Posted by Pete Sass @ 5/20/2009 11:43:52 PM
RE: Context menu on a form Posted by Antonio Massouh @ 5/21/2009 12:01:44 AM
RE: Context menu on a form Posted by John Terburg @ 5/25/2009 2:03:45 PM
RE: Context menu on a form Posted by Mike Gagnon @ 5/20/2009 11:45:15 PM
RE: Context menu on a form Posted by Antonio Massouh @ 5/20/2009 11:57:09 PM
RE: Context menu on a form Posted by Stefan Wuebbe @ 5/21/2009 9:41:32 AM
RE: Context menu on a form Posted by Antonio Massouh @ 5/22/2009 2:33:30 AM
RE: Context menu on a form Posted by Yousfi Benameur @ 5/21/2009 1:35:45 AM
RE: Context menu on a form Posted by Antonio Massouh @ 5/22/2009 2:44:42 AM
RE: Context menu on a form Posted by Yousfi Benameur @ 5/22/2009 10:47:18 AM
RE: Context menu on a form Posted by Antonio Massouh @ 5/22/2009 4:17:21 PM
RE: Context menu on a form Posted by Yousfi Benameur @ 5/22/2009 6:10:40 PM
RE: Context menu on a form Posted by Antonio Massouh @ 5/23/2009 2:12:02 AM
RE: Context menu on a form Posted by Yousfi Benameur @ 3/22/2011 10:59:42 AM