Page 1 of 1

texteditor.gadget

Posted: Fri Mar 30, 2018 2:14 am
by mritter0
At the bottom of the AutoDoc, it says:

uint32 result = IDoMethodA(APTR obj, struct GP_TEXTEDITOR_ExportText* msg);

Isn't that kind of misleading/confusing? Should be APTR or STRPTR for result?

STRPTR Data;

if ((Data=(STRPTR)IIntuition->IDoMethod(ChildObjects[GAD_TEXTEDITOR],GM_TEXTEDITOR_ExportText,NULL)))


Several of them say uint32 for the result.

Re: texteditor.gadget

Posted: Fri Mar 30, 2018 5:12 pm
by broadblues
IDoMethod() returns a uint32 as result, whose meaning will change with context.

Cast as required, but the actual return value is stil unit32.

Re: texteditor.gadget

Posted: Sat Mar 31, 2018 3:39 pm
by xenic
broadblues wrote:IDoMethod() returns a uint32 as result, whose meaning will change with context.

Cast as required, but the actual return value is stil unit32.
Since the SYNOPSIS is meant to demonstrate the use of a specific method, it would be clearer if the type casting were included in the SYNOPSIS for each method. As it stands, someone like me would attempt to use the function as shown in the SYNOPSIS and get a compile error before realizing some type casting was needed.

Re: texteditor.gadget

Posted: Sat Mar 31, 2018 5:47 pm
by broadblues
The synopsis doesn't demonstrate how to use the function though, if it did it would not contain the types of the various a parameters.

It describes the types of the functions arguments and return type, and so must be accurate.

Whther it needs a 'cast' would depend on the language you ultimately used to program it. (and what options).

A cast *should* be present in an C based example code though.