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

VFP 7.0 cut and paste 3

Status
Not open for further replies.

bettyfurr

Technical User
Mar 12, 2002
371
US
I have a memo field that I want to create a menu with edit and paste capabilities. Can someone steer me in the right direction? I know how to do a right click menu. What is the build in function to do the edit and paste?

Thank you,

Betty

 
Betty,

In brief:

- Open the menu designer.

- When prompted, choose Shortcut Menu (first thing you see when opening the designer).

- In the menu designer, use the Insert Bar button to insert Cut, Copy and Paste commands into the menu.

- Generate the menu.

- In the right-click event of the control where the memo field is displayed, write this code:
DO MyMenu.MPR

(Or, better, do it in the right-click of your appropriate base classes.)

That's just a quick overview. Come back if you need any flesh on the bones.

Mike


Mike Lewis
Edinburgh, Scotland
 
Hi Betty

You can use this in your short cut menu.
ON KEY LABEL CTRL+V SYS(1500, '_MED_PASTE', '_MEDIT')
ON KEY LABEL CTRL+C SYS(1500,'_MED_COPY','_MEDIT')
ON KEY LABEL CTRL+X SYS(1500,'_MED_CUT','_MEDIT')


Please note that the Ctrl+C, Ctrl+X, Ctrl+V is available for EditBox, Memo editing, TextBox controls etc. SO even without the rightclick menu, if you train the user, they can use it. SO there will be no need to create a shortcut and increase the application code.

May be you can provide the information n help texts.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Can do from this. I gave you a star. Thank you!

Betty
 
Ramani,

You can use this in your short cut menu.
ON KEY LABEL CTRL+V SYS(1500, '_MED_PASTE', '_MEDIT')
ON KEY LABEL CTRL+C SYS(1500,'_MED_COPY','_MEDIT')
ON KEY LABEL CTRL+X SYS(1500,'_MED_CUT','_MEDIT')



I don't see the point of that. Why would you put ON KEY LABELs in a shortcut menu? Just adding the shortcut keys to the menu will do the same (which is what happens when you insert a bar number).

I would have thought that ON KEY LABLE CTRL+V, etc. would be redundant, given that those particular keys are always tied to the corresponding actions -- as you pointed out to me in thread184-699318.

Or am I missing something?

Mike




Mike Lewis
Edinburgh, Scotland
 
Mike,

That was my Cut & Paste typo. The idea is to use the SYS()info on those on key label command which I readily had. Menu Pads need to be defined on those lines, if required. As I mentioned earlier, these are not required at all, since otherwise also these Ctrl+V or X or C will work.

:)



____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
I used the insert bar for copy, paste,undo in the shortcut menu. It does not work in an editbox. The ctrl+c and ctrl+v does. I have users who want the ability to copy and paste with a short cut. Can someone tell me if this can be done.

I put the shortcut menu in the right click event. I can select the menu item. It just doesn't response correctly.

Betty
 
Mike,

It is a right click event in an editbox. I highlight the text I want to copy. Do the right click; pick off copy,

go to the area in the edit box I want the paste. same editbox. Right click paste. It does not occur. I go back to the top of the edit box. Unless it is overlaying the same text.

*******
When I use ctrl+c and reposition my mouse pointer to another area in the editbox. do a ctrl+v. I see the text exactly were I wanted it.

Betty
 
Will do Thursday. I am out of the office Tuesday and Wednesday.

Thank you for your help.

Betty
 
There was no code that I could get through the class browser. Are there another way to get code. I did not code anything. Maybe that is the problem.

I am using the "bar insert" for the short cut bar. I insert the cut and the paste into the short cut menu.

Still don't know why this doesn't work. Are there a FAQ that you can steer me to read. I have tried to locate something on MS website that talked about a problem.

Please help.

Betty
 
Betty,

Did you create the menu by using the menu designer? if so, take the name that you saved the menu under. There will be a file somewhere on your disk with that name, and with the extension MRP. That's an ordinary program file, so you can open it by typing MODIFY COMMAND whatever.MPR in the command window.

If you could then copy the code in that file to a message in this thread, I will try running it to see what happens.

If you created the menu in some other way (you mentioned the class browser), let us have more details.

Mike


Mike Lewis
Edinburgh, Scotland
 
Will do Monday. It is at home. I did create it with the menu designer.

Thank you,

Please look for my code then.

Betty
 
Here is the mpr of the shortcut menu.

I know you will see something that is causing my problem.

*

DEFINE POPUP shortcut SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF shortcut PROMPT " Import" ;
PICTURE "..\program files\microsoft visual foxpro 7\copy.bmp"
DEFINE BAR 2 OF shortcut PROMPT "\-"
DEFINE BAR _med_copy OF shortcut PROMPT &quot;\<Copy&quot; ;
KEY CTRL+C, &quot;Ctrl+C&quot; ;
MESSAGE &quot;Copies the selection onto the Clipboard&quot;
DEFINE BAR _med_paste OF shortcut PROMPT &quot;\<Paste&quot; ;
KEY CTRL+V, &quot;Ctrl+V&quot; ;
MESSAGE &quot;Pastes the contents of the Clipboard&quot;
DEFINE BAR 5 OF shortcut PROMPT &quot;\-&quot;
DEFINE BAR _med_cut OF shortcut PROMPT &quot;Cu\<t&quot; ;
KEY CTRL+X, &quot;Ctrl+X&quot; ;
MESSAGE &quot;Removes the selection and places it onto the Clipboard&quot;
DEFINE BAR _med_undo OF shortcut PROMPT &quot;\<Undo&quot; ;
KEY CTRL+Z, &quot;Ctrl+Z&quot; ;
MESSAGE &quot;Undoes the last command or action&quot;
DEFINE BAR 8 OF shortcut PROMPT &quot;\-&quot;
DEFINE BAR 9 OF shortcut PROMPT &quot; Cancel&quot; ;
PICTURE &quot;..\program files\microsoft visual foxpro 7\wzclose.bmp&quot;
ON SELECTION BAR 1 OF shortcut ;
DO _13k0di594 ;
IN LOCFILE(&quot;\SIL\SFDOC&quot; ,&quot;MPX;MPR|FXP;PRG&quot; ,&quot;WHERE is SFDOC?&quot;)

ACTIVATE POPUP shortcut

* *********************************************************
*
PROCEDURE _13k0di594
SELECT PJ
DO FORM import_sfdoc

Thanks Betty :) :)
 
Betty,

Your code works perfectly. I had no problem in doing cut, copy, paste, undo. These all behaved as expected, both from the menu and via the corresponding shortcut keys.

The only small problem was that it could not find the image files. But when I removed the PICTURE clauses, that problem no longer came up.

Here's what I did:

- I copies your code to a file called BETTY.MPR.

- In the RightClick of an edit box on a form, I put this code:

DO BETTY.MPR

- I ran the form and right-clicked in the edit box. The menu popped up just as I expected.

How is that different from your own code? Exactly what behaviour did you see?

Mike


Mike Lewis
Edinburgh, Scotland
 
I highlight I want to move down in the edit box.
xxxxxxxxxxxxxxx mmmm
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

I cut the text mmmm
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

I put my cursor on the last line and right click and select paste. It puts the mmmm exactly where it was not at the end of the text where I wanted to insert it.

xxxxxxxxxxxxxxx mmmm
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

When I use the ctrl+x and the ctrl+ v, the results are correct.

Betty
 
Betty,

When you say you put the cursor on the last line, do you mean the mouse pointer or the insertion point? Do you actually click (left-click) at the point where you want to paste before you right-click? If you don't, the insertion point is still where it was previously. That's where the text will be pasted. This is normal Windows behaviour.

Mike


Mike Lewis
Edinburgh, Scotland
 
I left click where I want the paste to occur. Then I right click and select the paste.

I know that I do this because that was my first thought I was not putting the text pointer in the spot. I even keyed some data there and do a right click. That should have definitely been the spot.

Any suggestions?

Betty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top