Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RTF -- a PITA or what?
Message
From
05/05/1998 20:28:31
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00096430
Message ID:
00097198
Views:
24
>Hi Mark,
>
>When are you attempting this??? I bascially do the same thing.
>
>I subclasses the RTF control. Here is the code:
>
>Notice that I created a few custom properties to hold the bound field - and a custom method that takes care of writing data back to the bound field.
>
>HTH,
>
>< JVP >
>
>
>
>**************************************************
>*-- Class: olertf (c:\winnt\profiles\john\personal\code\oleclasses.vcx)
>*-- ParentClass: olecontrol
>*-- BaseClass: olecontrol
>*-- OLEObject = C:\WINNT\System32\richtx32.ocx
>*
>DEFINE CLASS olertf AS olecontrol
>
>
> Height = 193
> Width = 289
> *-- This property holds the file name of the contained document.
> cfilename = (Space(0))
> Name = "olertf"
>
> *-- If .T., various user notifcations will be displayed.
> lnotify = .F.
>
> *-- This property tracks when unsaved changes exist.
> lchanged = .F.
>
> *-- This property holds the field to which the RTF Control is bound
> boundfield = .F.
> errorcode = .F.
>
>
> *-- This method will refresh the display based on contents in the boundfield
> PROCEDURE refreshdisplayfromboundfield
> This.TextRtf = Eval(This.BoundField)
>
> Return
> ENDPROC
>
>
> *-- This method will update the contents of the memo with the RTFTEXT Property of the RTF Control.
> PROCEDURE updateboundfield
> Replace (This.BoundField) With This.TextRtf
>
> Return
> ENDPROC
>
>
> PROCEDURE Error
> LPARAMETERS nError, cMethod, nLine
> Local Array aErrors[1]
> Aerror(aErrors)
> This.ErrorCode = aErrors[1,6]
>
> Return
> ENDPROC
>
>
> PROCEDURE KeyPress
> *** OLE Control Event ***
> LPARAMETERS keyascii
> This.lChanged = .T.
> ENDPROC
>
>
> *-- This method will print RTF document to printer.
> PROCEDURE printdocument
> ENDPROC
>
>
>
>
> PROCEDURE errorhandler
> ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: olertf
>**************************************************


John,

Thank you so much for the info! I was starting to think I'd never get a response and this error pretty much makes my app an embarrassment!

Here's what I'm doing:
**********************

1) In the DESTROY event of my form:
REPLACE mytable.memo WITH THISFORM.pf1.p_notes.rtf_notes.TextRTF

(the RTF control is within a pageframe just to be clear)

2) In the LOAD event of my form:
THIS.cText = mytable.memo

3) Likely not important, but in the GOTFOCUS event of the RTF control:
KEYBOARD '{CTRL+END}' (I was hoping to have the notes move to the end automatically (any suggestions?))

4) In the LOSTFOCUS event of the RTF control:
REPLACE mytable.memo WITH THISFORM.pf1.p_notes.rtf_notes.TextRTF

That's it! When I close the form, about 99% of the time, I get that error. It seems if I never do anything in the form (change records or access the notes page), the error will usually not occur.

I am also noticing some difficulty with the notes being erased or at least not showing up properly within this control's area. The notes are being imported (one-time deal before I ever run the form) from a table with a memo field (mytable.memo), but the text was never RTF -- just plain text.

If you have any further thoughts, I'd be interested in hearing them. I need to get this app out and like I said, it's a bit embarrassing and it certainly draws unwanted attention and causes unnecessary concern.

I noticed your credentials; they are quite impressive. I've not been in touch with someone who's actually responsible for turning out VFP itself! I read where that was written in Microsoft C++ -- true?

TIA!

Sincerely,

Mark
mark@remarkable-systems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform