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!

Ctrl+V does not function in the _med_find short cut menu

Status
Not open for further replies.

taterday

Programmer
Jan 28, 2009
183
US
I need help. This is my problem. It is located on a page frame in a edit box, attached to a memo field in a DB.

I have the short cut menu as defined. When doing a find/replace the users requested 2 things.

The ability to ctrl C/copy into the find area and Ctrl V/paste into the replace area.

The ability to extend the scope to the other memo/edit boxes.

For example: When the ctrl+v is used in the _med_find box typing area,nothing happens.


DEFINE POPUP shortcut SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR _med_find OF shortcut PROMPT "\<Find..." ;
KEY CTRL+F, "Ctrl+F" ;
MESSAGE "Searches for specified text"
DEFINE BAR _med_repl OF shortcut PROMPT "R\<eplace..." ;
KEY CTRL+L, "Ctrl+L" ;
MESSAGE "Replaces specified text with different text"
DEFINE BAR 3 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 6 OF shortcut PROMPT "\-"
DEFINE BAR _med_undo OF shortcut PROMPT "\<Undo" ;
KEY CTRL+Z, "Ctrl+Z" ;
MESSAGE "Undoes the last command or action"
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 9 OF shortcut PROMPT "\-"
DEFINE BAR 10 OF shortcut PROMPT " Cancel"
ACTIVATE POPUP shortcut
 
You seem to have two different problems.

First, you can't copy or paste into the Find dialogue. I can't see any reason for that. It should work OK. It does for me.

You also say you want to "extend the scope to other edit/memo boxes". Do you mean the scope of the Find? If so, you can't do that. It's not how the Find dialogue works. You would have to create your own Find dialogue (as a modal form) and do the search programmatically (which is not particularly difficult).

Or, do you mean you want to extend the form so that shortcut menu is available in other edit boxes? If so, then you need to call your code from the RightClick of the controls in question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The native Find/Replace dialog is meant for the VFP IDE only, anyway. The Scope section of the dialog makes no sense elsewhere.

Defining CTRL+F for your form or memo field does not necessarily extend or influence the behavior of the Find dialog. Like Mike says I wouldn't expect the find dialog to function different, just because you created a popup. It's not getting the popup for the whole desktop or even your app.

So if you want more control, it's time to roll your own find dialog, really.

Bye, Olaf.
 
Thank you, Mike.
First, you can't copy or paste into the Find dialogue. I can't see any reason for that. It should work OK. It does for me.

Me:
Could I have stop the action someway? It puts what appears to be an non-printable character when I do a ctrl+V in the find box.



 
Could I have stop the action someway?

Yes, you could have stopped the action.

Paste "belongs" to the system menu. You're providing it in your own popup PROVIDED that popup is still defined when you try to use it.

What's after ACTIVATE POPUP in the code you posted? Are you releasing the popup after allowing the user to call up the Find/Replace dialog?
 
yes. I call (do docs.mpr) the menu out of the right click event.
They use the menu and then I release it.

Is there an article on how to create your own find?

If I can't get this to work, I know the users will not be satisfied until I get a better solution.
 
It's a really simple solution and the logic isn't difficult to follow:

* CTRL-V functionality is provided by a menu.
* You're releasing the menu.

To keep the CTRL-V functionality, DON'T RELEASE THE MENU.

It isn't rocket science.
 
Taterday,

Even when you've got the Ctrl+V functionality working, that won't solve the other problem: the Find dialogue not working across the scope of other edit boxes.

If that's important to you, you will have to create your own Find dialogue. You won't find an article on how to do that. It's just an ordinary dialogue - that is, a modal form - with labels and textboxes and buttons.

The actual searching can be done with some simple program code. For example, you can use OCCURS() to find how many times the search string apears in the text of the edit box, and AT() to find each occurrence in turn. STRTAN() can be used to replace one string with another. And so on.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thank you guys for all your suggestions.

I commented out the release of the menu but nothing changed. Still got the non-printable character in the find area. Paste not working.

This must be something that I have in the code that is causing this.

Thank you again for your help.
 
For CTRL+V to work, the Edit menu of the system menu must be available with the Paste option on it. You don't have to display the system menu, but it must exist.

Tamar
 
The ctrl_V and ctrl_x, works when I am not in the find and replace box.

I have these statements in the main program.

_screen.visible=.f.


IF WEXIST('standard')
DEACTIVATE WINDOW 'standard'
ENDIF

Is this my problem?

Thank you,

 
None of that code should have anything to do with it.

(Do you have any idea what that code actually *does*?)

Are you trying to do this in a modal form?
 
I am not experienced like you guys. Those were the only 2 statements that affected the system.

I am doing this on a page frame, edit box attached to a memo field using the right click event, then a 'do shortcut menu.' I put the contents of this above.

I have been researching and found the findtext.dlg suggestion on microsoft. It looks promising. I couldn't find the file. Does anyone know how to find this?


 
PLEASE STOP. THINK.

One of the VERY FIRST THINGS you should do is answer the question I asked: is this on a modal form?

I did not ask the question out of idle curiosity or for health reasons. Modal forms subvert the normal handling of system menus and could easily cause the behavior you're seeing.

(.dlg is not a Foxpro file extension so a file with that name likely won't help you with anything.)
 
Diagnostic step #1: make the form non-modal and see if the problem goes away.

If so, then we've isolated the problem! And once we've isolated the problem, we can SANELY proceed to a solution!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top