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?
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.
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.
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.
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.
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.
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.
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.
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 "\<Copy" ;
KEY CTRL+C, "Ctrl+C" ;
MESSAGE "Copies the selection onto the Clipboard"
DEFINE BAR _med_paste OF shortcut PROMPT "\<Paste" ;
KEY CTRL+V, "Ctrl+V" ;
MESSAGE "Pastes the contents of the Clipboard"
DEFINE BAR 5 OF shortcut PROMPT "\-"
DEFINE BAR _med_cut OF shortcut PROMPT "Cu\<t" ;
KEY CTRL+X, "Ctrl+X" ;
MESSAGE "Removes the selection and places it onto the Clipboard"
DEFINE BAR _med_undo OF shortcut PROMPT "\<Undo" ;
KEY CTRL+Z, "Ctrl+Z" ;
MESSAGE "Undoes the last command or action"
DEFINE BAR 8 OF shortcut PROMPT "\-"
DEFINE BAR 9 OF shortcut PROMPT " Cancel" ;
PICTURE "..\program files\microsoft visual foxpro 7\wzclose.bmp"
ON SELECTION BAR 1 OF shortcut ;
DO _13k0di594 ;
IN LOCFILE("\SIL\SFDOC" ,"MPX;MPR|FXP;PRG" ,"WHERE is SFDOC?"
ACTIVATE POPUP shortcut
* *********************************************************
*
PROCEDURE _13k0di594
SELECT PJ
DO FORM import_sfdoc
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?
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.
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.