Graham,
Can I ask what you are trying to accomplish? Is just to display
RichText documents, or do you want to be able to edit them and then
resave?
>That sounds good. My customer will be using this app on all versions of
>Windows from XP onwards. My only development machine is XP SP3. Will it work
>on XP?
I don't think so. It uses the latest version of the Windows control,
and as I recall that only came with Vista (and 7 and 8).
The following might give you some ideas (workspace code)
s := Shell show.
rt := (RichTextEdit new)
parentView: s view;
create;
yourself.
s view layoutManager: BorderLayout new.
rt arrangement: #center.
s view addSubView: rt.
fn := FileOpenDialog showModalOn: '*.rtf'.
fs := FileStream read: fn.
[rt readRtfFrom: fs] ensure: [fs close].
The above should enable you to open a rtf file and edit it. It might
take a bit more to get scrolling working, #canVScroll and #canHScroll
don't seem to work on a RichTextEdit, at least in the simplified way
I'm using it here.
fn := FileSaveDialog showModalOn: '*.rtf'.
fs := FileStream write: fn.
[fs nextPutAll: rt text rtf] ensure: [fs close]
Evaluating this in the _same_ workspace should resave the file. NB
the #rtf in the last line is marked as private but I can't remember
the clean way to do it.
It must be 6 or 7 years, if not more, since I delved into the murky
world of RichTextEdits; I had forgotten how much brain ache they could
cause :-(