Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 Tags
Subject: RE: InputBox copy-paste
Thread ID: 268959 Message ID: 269045 # Views: 38 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Classes and Objects
Date: Friday, July 16, 2010 8:52:45 AM         
   


Hi Yousfi
If we use "_med_undo OF _medit", VFP will manage enable-disabling of menu items.
DEFINE BAR _med_undo OF _medit PROMPT "\<Undo" KEY CTRL+Z, "Ctrl+Z" PICTRES _med_undo ;

In your example, items are always enabled. I tried to put "_med_undo OF _medit" in a form, but couldn't make it work, may be because of conflicts with the main VFP menu.

Is there a way to have automatic enable-disabling of editing menu items in a form, without additional custom code?


> > Hi Fox(f)i(gh)ters,
> >
> > since I noticed that InputBox works with CTRL+C or CTRL+V keystrokes when called directly from VFP environment,
> > and doesn't work when called from some forms, does anyone knows why that could be?
> > When I press CTRL+C or CTRL+V from mentioned forms I always get same special character.
> > It could be some of the forms settings or environmental settings, but I don't know witch one could be.
> >
> > Regards,
> > Nikola.
>
> You can integrate in textbox or editbox a contextuel menu to enhance the edit capabilities. To test that , run this code:
>
> *!*--Author Yousfi Benameur El Bayadh Algeria
> *!*--Time stamp jeudi 15 juillet 2010; 16:19:07
> *!*--Subject :Contextuel menu on rightclic in textbox,editbox
> *!*--Version VFP9SP2
> 
> *!*--Begin Code
> LOCAL yForm as Form
> yForm = CREATEOBJECT('asup')
> yForm.Show(1)
> RETURN
> 
> DEFINE CLASS asup as Form
>     showWindow=0
> 	AutoCenter = .T.
> 	height=300
> 	width=500
> 	caption="Rightclic to fire Edit contextuel menu in textbox,editbox"
> 	name="form1"
>      
>      
>     ADD OBJECT text1 as Textbox WITH ;
> 		Left = 50, Top = 10, ;
> 		Width = 200, Height = 25, ;
> 		Anchor = 15 
> 		
> 	ADD OBJECT Edit1 as Editbox WITH ;
> 		Left = 10, Top =45, ;
> 		Width = 450, Height = 220, ;
> 		Anchor = 15
> 
>     PROCEDURE INIT
>     bindevent(this.text1,"rightclick",this,"myMenu")
>     bindevent(this.edit1,"rightclick",this,"myMenu")
>     
>    
> PROCEDURE myMenu()
> 	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
> *!*--End Code
> 

> you can build the contextuel menu in the vfp menu designer and compile it to an mpr file....cut the code and put it in myMenu() procedure.
>
> Regards
>
>
> Regards
> Yousfi Benameur



Regards
Samir

ENTIRE THREAD

InputBox copy-paste Posted by dcNiko Vujke @ 7/15/2010 4:24:40 PM
RE: InputBox copy-paste Posted by Mike Gagnon @ 7/15/2010 4:50:42 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/15/2010 6:38:10 PM
RE: InputBox copy-paste Posted by Mike Gagnon @ 7/15/2010 8:53:58 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 9:40:42 AM
RE: InputBox copy-paste Posted by Samir H. @ 7/19/2010 9:48:04 AM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 10:49:12 AM
RE: InputBox copy-paste Posted by Samir H. @ 7/19/2010 10:58:34 AM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 11:25:30 AM
RE: InputBox copy-paste Posted by Samir H. @ 7/19/2010 12:00:27 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 12:36:48 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 1:03:44 PM
RE: InputBox copy-paste Posted by Samir H. @ 7/19/2010 1:30:38 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 1:33:02 PM
RE: InputBox copy-paste Posted by Samir H. @ 7/19/2010 1:48:24 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/19/2010 2:14:56 PM
RE: InputBox copy-paste Posted by Yousfi Benameur @ 7/15/2010 5:31:05 PM
RE: InputBox copy-paste Posted by dcNiko Vujke @ 7/15/2010 6:43:47 PM
RE: InputBox copy-paste Posted by Samir H. @ 7/16/2010 8:52:45 AM
RE: InputBox copy-paste Posted by Yousfi Benameur @ 7/16/2010 9:42:09 AM
RE: InputBox copy-paste Posted by Samir H. @ 7/16/2010 11:18:11 AM
RE: InputBox copy-paste Posted by Yousfi Benameur @ 7/16/2010 11:40:17 AM
RE: InputBox copy-paste Posted by Samir H. @ 7/16/2010 11:51:25 AM
RE: InputBox copy-paste Posted by Yousfi Benameur @ 7/16/2010 7:14:28 PM
RE: InputBox copy-paste Posted by Samir H. @ 7/16/2010 7:40:41 PM
RE: InputBox copy-paste Posted by Yousfi Benameur @ 7/16/2010 10:52:50 PM
RE: InputBox copy-paste Posted by Samir H. @ 7/17/2010 6:11:54 AM
RE: InputBox copy-paste Posted by subhankar pandey @ 7/20/2010 7:49:37 AM