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 to a memo field in an application

Status
Not open for further replies.

DonKlemencic

Programmer
Aug 14, 2002
2
US
I have users who have to enter the same note into a memo field for many records in a table. They would like to store standard notes in an external notepad file and then copy and paste to the memo field instead of re-typing. Copying and pasting to the memo field works for me in the command window, but when I try to do it in the context of a form in my application the pasting produces an upright rectangular character instead of the text I copied to the buffer.

Any help making this possible would be greatly appreciated. Thank you.


 
I assume you want to use a form?
Let's assume you have two textboxes, one the input box, one the receiving box.
Use a copy button. In the click event put:
_CLIPTEXT = THISFORM.TEXT1.VALUE

And in the paste button:

STORE _CLIPTEXT TO Thisform.text2.value
Here is the whole pseudo code:
Code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (c:\scroll\form1.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   08/19/02 07:29:08 PM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 48, ;
		Top = 24, ;
		Width = 288, ;
		Name = "Text1"


	ADD OBJECT text2 AS textbox WITH ;
		Height = 23, ;
		Left = 60, ;
		Top = 120, ;
		Width = 288, ;
		Name = "Text2"


	ADD OBJECT commandgroup1 AS commandgroup WITH ;
		AutoSize = .F., ;
		ButtonCount = 2, ;
		Value = 1, ;
		Height = 37, ;
		Left = 132, ;
		Top = 60, ;
		Width = 112, ;
		Name = "Commandgroup1", ;
		Command1.AutoSize = .F., ;
		Command1.Top = 5, ;
		Command1.Left = 5, ;
		Command1.Height = 27, ;
		Command1.Width = 50, ;
		Command1.Caption = "Copy", ;
		Command1.Name = "Command1", ;
		Command2.AutoSize = .F., ;
		Command2.Top = 5, ;
		Command2.Left = 57, ;
		Command2.Height = 27, ;
		Command2.Width = 50, ;
		Command2.Caption = "Paste", ;
		Command2.Name = "Command2"


	PROCEDURE commandgroup1.Command1.Click
		_cliptext = thisform.text1.value
	ENDPROC


	PROCEDURE commandgroup1.Command2.Click
		STORE _cliptext TO thisform.text2.Value
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
 
Have them save the file in notepad, then use FILETOSTR(), etc, to put it in the memo field.

Alternatively, you could have them do the input in your form, then use STRTOFILE() to write it to a text file.

You'll have more control over the process using this second option.

Clayton
 
have a seperate table with a memo field. this table holds the templates for the users to choose from. when a user selects the tamplate. in the click of a button use the _cliptext as posted by mgagnon. Attitude is Everything
 
Another option using dancemans template table suggestion, in the Click event you can do something like:

SELECT Template
SCATTER MEMVAR MEMO FIELDS MemoField

SELECT LiveTable
GATHER MEMVAR MEMO FIELDS MemoField
Dave S.
 
I believe all you need to do, is to re-enable the paste menu option. I assume that when they get the funny box character, they're pressing Ctrl+V (paste). Instead, it just put's a Ctrl+V-Character in.

Create a new menu, tell VFP to make a "Quick Menu" (On the "Menu" menu while editing the menu), then Generate, then copy the _mEdit menu out of "whatever you just made.mpr" into your program's menu system. As long as the menu bar for Paste has a hotkey of Ctrl+V, then Ctrl+V will from then on properly paste. (You can keep the entire "Edit" menu, or just take the "Cut", "copy" and "Paste" bars, with their system bar names, and put them into your own menu)

- bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top