The autodocs are very sparse on how to do any importing/exporting of text. How do you get the text via the hook?
- TEXT GlobalStringBuffer;
- struct GP_TEXTEDITOR_ExportText *GP_TE_ET;
- GP_TE_ET=IExec->AllocVecTags(sizeof(struct GP_TEXTEDITOR_ExportText),
- AVT_Type, MEMF_SHARED,
- AVT_ClearWithValue, 0,
- TextEditorExportTextHookFunc(struct Hook *hook,APTR texteditor,struct GP_TEXTEDITOR_ExportText *exportmsg)
- // what goes in the hook????
What goes in the hook to export the text?
Nothing goes in the hook, that's not how it works.
The hook is for formatting the text as email / plain text etc
Note that custom hooks aren't supported (or needed really, in most usage) further to that with the OS4 version as far as I can tel only GV_TEXTEDITOR_ExportHook_Plain works.
PS in you example you never set the method in your GP_TEXTEDITOR_ExportText message so it won;t do anything. That might just be an oversite in your forum post but thought I'd point it out just in case...
Go it. Thank you.
This is how you export text from a TextEditor Gadget:
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
Thanks from my part as well !
I have had it all working, but turned on -O3 (gcc optimize) and compiled my code, get an error:
warning: dereferencing type-punned pointer will break strict-aliasing rules
CFLAGS = $(INCPATH) -Wall -Werror -Wwrite-strings -Wextra -Wno-unused-parameter -O3
The warning refers to the IDoMethodA() line. I tried a few things but can't get past it. Any ideas?
TBH the easiest "fix" is to add -Wno-strict-aliasing to your warning options after -Wall
Building your message in the stack as Thomas suggests gets round this for that specific case, but for more complex message types, that's sometimes less convenient, and you can also get them in calls to GetAttr() .