Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with merge two RTF
Message
From
10/06/2008 09:30:53
Reza Meamar
Homa Programming Group
Shiraz, Iran
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Problem with merge two RTF
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01322805
Message ID:
01322805
Views:
126
Dear all,
Please see below code.
PUBLIC oMyForm
oMyForm = CREATEOBJECT("mergertf")
oMyForm.show

RETURN

***********************************************************
DEFINE CLASS mergertf AS form

	Top = 0
	Left = 0
	Height = 300
	Width = 696
	ShowWindow = 1
	DoCreate = .T.
	ShowTips = .T.
	AutoCenter = .F.
	BorderStyle = 3
	Caption = "Edit Answer"
	ControlBox = .F.
	MaxButton = .F.
	MinButton = .F.
	MinWidth = 580
	WindowType = 1
	HelpContextID = 154
	Name = "rad_answer"


	ADD OBJECT olertf AS olecontrol WITH ;
		Top = 5, ;
		Left = 5, ;
		Height = 78, ;
		Width = 557, ;
		TabIndex = 2, ;
		OLEClass="RICHTEXT.RichtextCtrl.1",;
		ControlSource = "", ;
		Name = "oleRTF"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 264, ;
		Left = 306, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Exit", ;
		TabIndex = 5, ;
		Name = "Command1"


	ADD OBJECT olertf1 AS olecontrol WITH ;
		Top = 86, ;
		Left = 5, ;
		Height = 78, ;
		Width = 557, ;
		TabIndex = 3, ;
		OLEClass="RICHTEXT.RichtextCtrl.1",;
		ControlSource = "", ;
		Name = "oleRTF1"


	ADD OBJECT olertf2 AS olecontrol WITH ;
		Top = 168, ;
		Left = 5, ;
		Height = 78, ;
		Width = 557, ;
		TabIndex = 4, ;
		OLEClass="RICHTEXT.RichtextCtrl.1",;
		ControlSource = "", ;
		Name = "oleRTF2"


	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 154, ;
		Left = 581, ;
		Height = 27, ;
		Width = 105, ;
		Caption = "Merge Two RTF", ;
		TabIndex = 1, ;
		Name = "Command3"


	PROCEDURE Init
		* Check to see if OCX installed and loaded.
		IF TYPE("THIS.oleRTF") # "O" OR ISNULL(THIS.oleRTF)
			RETURN .F.
		ENDIF


		thisform.olertf.text = "First Line"

		THISFORM.oleRTF.SelStart = 0
		THISFORM.oleRTF.SelLength = Len(THISFORM.oleRTF.Text)

		thisform.olertf.selfontSize = 18
		thisform.olertf.selAlignment = 2

		THISFORM.oleRTF.SelStart = 0
		THISFORM.oleRTF.SelLength = 0

		thisform.olertf1.text = "Second Line"
		thisform.olertf2.text = ""
		
	ENDPROC


	PROCEDURE command1.Click
		thisform.Release
	ENDPROC


	PROCEDURE command3.Click

		    THISFORM.oleRTF.SelStart = 0
		    THISFORM.oleRTF.SelLength = Len(THISFORM.oleRTF.Text)

		    THISFORM.oleRTF1.SelStart = 0
		    THISFORM.oleRTF1.SelLength = Len(THISFORM.oleRTF1.Text)

		    THISFORM.oleRTF2.SelStart = 0
		    THISFORM.oleRTF2.SelLength = Len(THISFORM.oleRTF2.Text)
		    THISFORM.oleRTF2.SelRTF = THISFORM.oleRTF.SelRTF
		    THISFORM.oleRTF2.SelStart = Len(THISFORM.oleRTF2.Text)
		    THISFORM.oleRTF2.SelLength = 0
		    THISFORM.oleRTF2.SelText = CHR(10)
		    THISFORM.oleRTF2.SelStart = Len(THISFORM.oleRTF2.Text)
		    THISFORM.oleRTF2.SelLength = 0
		    THISFORM.oleRTF2.SelRTF = THISFORM.oleRTF1.SelRTF

		    THISFORM.oleRTF.SelStart = 0
		    THISFORM.oleRTF.SelLength = 0
		    THISFORM.oleRTF1.SelStart = 0
		    THISFORM.oleRTF1.SelLength = 0
	ENDPROC


ENDDEFINE
When you press MERGE TWO RTF key, the format of First Line will be erase.
But if you select all content in first control ( Ctrl + A ) and paste it in third control, so select all content in second control ( Ctrl + A ) and paste it at the end of third control, all things is correct !
WHY?
Can anyone help me?
Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform