I don't work with rich text alot, but I am aware of its eccentricities. I learned a few things this week and I thought I'd share them so as to save someone the time and frustration I endured. Starting out, I was at least aware of the whole issue with refreshing rich text in the UI, so this influenced my ideas of how I was going to approach my project.
For a Notes client app. I needed to control editing of a rich text field on a form. My first thought was to have a computed field just display the contents of the field and create a dialog box for authorized folks to edit the actual data. Although this is possible with some workarounds, the default nature of LotusScript dialog boxes is not rich text friendly. By default you can control the passing of field changes from your dialog box back into the underlying form, but not with rich text. The workarounds are to get rid of the default "OK" and "Cancel" buttons and build your own directly on your dialog box form so you can save your changes to the back end and do some script magic to make the changes appear on the underlying form. After working on the script magic and getting things to refresh, I found a show-stopping flaw in my approach. The biggest problem with this approach is that you don't have access to the rich text controls for adding any formatting to your text -- without that, what's the point? The bottom line is I abandoned the dialog box and opted to go with computed and editable fields and some show/hide formulas on the main form.
The first thing I ran into with this approach was the fact that a computed rich text field acts like a computed when composed field. The field gets set the first time it is displayed, but won't change if you make changes to the field it is computed to. Luckily Google is my friend and I found a way to make this approach work. Basically, I added a third computed text field with the formula FIELD myComputedRTF := @DeleteField; "" which blows the computed rich text field away every time the document is saved so that it can be recreated the next time it is opened.
Hope this saves someone the time and hassle learning this the hard way...
Thursday, June 18, 2009
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment