texteditor.gadget

Have a question about our Software Developer Kit? Ask them here.
Post Reply
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

texteditor.gadget

Post 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.
Workbench Explorer - A better way to browse drawers
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: texteditor.gadget

Post 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.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: texteditor.gadget

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: texteditor.gadget

Post 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.
Post Reply