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

pasting text from one window to another

Status
Not open for further replies.

Dgoldswo

Programmer
Jan 9, 2001
9
US
I am trying to develop a routine where a user is editing in one window and upon highlighting text and hitting ctrl+c another window opens with a blank editing region selected where the user could enter ctrl+v to paste the text which has been highlighted. I am getting stymied by ON KEY AND KEYBOARD. Is this the right approach?
 
HI
1. YOu can hold the variable as a PUBLIC variable and get the info passed between windows..
2. If they are in two different pieces .. you can pass it as parameters from one to another.. READ HELP ON PARAMETERS

Cut & Paste .. is not always the correct approach, unless you want part of a MEMO field to be edited and used in another place.

Hope this helps :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
First, it would be useful to know if you are doing this for a FoxPro for Windows app or a FoxPro DOS app (or a cross-platform app).

In general other than your "another window opens", you can just add your own menu pad with the system keys defined to do this. The following comes from a cross-platform app that allowed the viewing and navigating of text files. With the appropriate changes, I believe you could achieve what you need.
Code:
** Assumes "lcrptfile" holds the file to be looked at
**  and "zcpretitle" holds the Preview window title

PRIVATE lcmenutype
lcmenutype = SET("SYSMENU")	
PUSH MENU _MSYSMENU
SET SYSMENU TO _medit
			
DEFINE PAD _MSM_EDIT OF _MSYSMENU PROMPT &quot;\<Navigate&quot; ;
    COLOR SCHEME 3 KEY ALT+N, &quot;&quot;
ON PAD _MSM_EDIT OF _MSYSMENU ACTIVATE POPUP _medit
	
DEFINE POPUP _medit MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR _MED_GOTO OF _medit PROMPT &quot;Jump to <Line... &quot; ;
    KEY CTRL+J, &quot;^J&quot;
DEFINE BAR _MED_FIND OF _medit PROMPT &quot;\<Find...&quot; ;
   KEY CTRL+F, &quot;^F&quot;
DEFINE BAR _MED_FINDA OF _medit PROMPT &quot;Find A\<gain&quot; ;
   KEY CTRL+G, &quot;^G&quot;
DEFINE BAR 1 AFTER _MLAST OF _medit PROMPT &quot;\<Done&quot; ;
   KEY CTRL+W, &quot;^W&quot;
ON SELECTION BAR 1 OF _medit keyboard '{esc}' plain

SET SYSMENU ON
	
IF _DOS
   DEFINE WINDOW lwedit FROM 0,0 ;
      TO srows()-1,scols()-1 SYSTEM TITLE zcpretitle ;
      CLOSE NOGROW NOFLOAT NOZOOM COLOR SCHEME 8
   MODIFY FILE &lcrptfile WINDOW lwedit NOEDIT
   RELEASE WINDOW lwedit
ELSE
   DEFINE WINDOW lwedit ;
      AT  0.000, 0.000  ;
      SIZE 30,76.000 ;
      TITLE zcpretitle ;
      FONT &quot;FoxFont&quot;, 9 ;
      FLOAT ;
      CLOSE ;
      NOMINIMIZE ;
      SYSTEM
   DEFINE WINDOW lwedit2 ;
      AT  0.05, 0.05  ;
      SIZE 29.1,74.8 ;
      IN WINDOW lwedit  ;
      FONT &quot;FoxFont&quot;, 9 ;
      NOMINIMIZE ;
      SYSTEM
   MOVE WINDOW lwedit CENTER
   ACTIVATE WINDOW lwedit
   MODIFY FILE &lcrptfile WINDOW lwedit2 NOEDIT
   RELEASE WINDOW lwedit
ENDIF
POP MENU _MSYSMENU
***SET SYSMENU AUTOMATIC && kill access to menu
SET SYSMENU &lcmenutype
Rick
 
Hi,

You should also have to take into consideration the &quot;modality&quot; of the windows if you want to use CTRL+C CTRL+V as hot keys in the menu bar (by the way, the only way I know in FPW)

I mean, if you are using modal windows, you won't be able to access the menu bar unless you activate the menu from within the window itself.

For example, if your system menu bar is called &quot;mymenu.mpr&quot;, you just have to include the following lines in the WHEN snippet:

SET SKIP OF MENU _MSYSMENU .f.
DO mymenu.mpr

As I consider an Edit menu very usefull, I create it once by using the quick menu option and erasing the rest of unnecesary popups. Then I inserted in my main menu any time I need it.

Hope this helps!

David.
 
OK. Thanks for the suggestions. What I wanted was a quick way for the end user to print a section of a memo field.

What I did was after the section was highlighted and the user hit ctlr+c, I had the user hit ctrl+a and assigned an ON KEY routine to crtl+a that initialized a variable(text edit region in the new screen with the memory buffer)

store _cliptext to mynewvar
do mynewscreen.spr

Screen pops up with the highlighted text and they are ready to print.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top