TextEditor and bold/italice/underlined styles

Online Status

Hi,

I try to display bold, italic and underlined words in a TextEditor gadget. It works when creating the gadget by using:
LAYOUT_AddChild, TxtEd = TextEditorObject,
GA_ReadOnly, TRUE,
GA_TEXTEDITOR_BevelStyle, BVS_NONE,
GA_TEXTEDITOR_Contents, "\33bbold\33iitalic\33uunderlined\33nnormal",
GA_TEXTEDITOR_ImportHook, GV_TEXTEDITOR_ImportHook_Plain,
TAG_END),

But if I try to add the same string (except a leadin \n) after the creation of the window:
DoGadgetMethod((struct Gadget *)TxtEd, window, NULL,
GM_TEXTEDITOR_InsertText, NULL, (ULONG) "\n\33bbold\33iitalic\33uunderlined\33nnormal",
GV_TEXTEDITOR_InsertText_Bottom);

\n is well interpreted but it seems that \33b, \33i... are no longer.
So the new line is displayed without any bold, italic, underlined styles.

What am I doing wrong?

You can download source, exe and screenshot of the problem here:
http://boing.attitude.online.fr/temp/Test_TextEditor.zip

Thanks in advance.

Online Status

Anyone?

Online Status

Meeeee !
:)
Maybe it has to do with these hooks attribs :
https://developer.amigaos3.net/autodocs/texteditor.gadget/
Apparently there are "many text hook to manage the text formats", and a default hook.
it looks like:
GA_TEXTEDITOR_ImportHook
"Since this gadget allows different text styles, you can supply an importhook to parse the text correctly. "
The default importhook understands the following escape sequences: (then comes the escape characters list)

...and if I get it, a hook would call this func in texteditor_protos.h:
/*--- functions in V47 or higher (Release 3.2) ---*/
VOID __stdargs HighlightSetFormat( APTR object, ULONG pos, ULONG end, ULONG style );

so basically, when you insert it's not treated with the correct "hook"...

... Hey would this thing allow to have a UTF-8 Editor ? I dream of a full UTF-8 OS3. so I can and copy paste smileys and flowers in it.

Online Status

@krabob, Yes, maybe. I'll check it to add the hook when adding it.

I don't think so for UTF-8, but my software, Dir Me Up, handled it (and UTF-16 too) ;) It only previews, though, not edits.

Search for the 'DiMeUp' video on YouTube (6min43)

Online Status

Hey, I'm a bare OS3.2 user with not much plugin, still using goodold DirOpus4. Can I ask for tabs with differents dirs with Ctrl+T because I always have to much dirs windows opened. ? Can you dragndrop from list for copy ? ... Well I'll give a try. In all cass that's way better than the horrible and bugged windows explorer of windows11.

Online Status

@krabob, no tabs so far. You can drop from the workbench but not to the Wb.

Online Status

Both utf8 and drag and drop is on my wish list for the future, but so far not a single line of code has been written to that effect. As to the original question then it doesn't work like that. the only way is via GA_TEXTEDITOR_Contents sewtting everything, and you better make it readonly as editing will mess up the contents

Online Status

@Camilla, thanks. GA_TEXTEDITOR_Contents is the way to go.