incorrect docs?

the docs for ApCreateDBWidgetFamily() aren’t completely correct, because
they say, you have to invoke ApCreateDBWidget() for the container and all
child-widgets of the container in order to get access to the
widget-pointers…

if i do so and give the function a parent argument, i insert a new widget
into widget-tree and if i use a null parent argument app crashes, so the
docs should say you have to invoke ApCreateWidget() instead of
ApCreateDBWidget() to get that behaviour

mirtch <mirtch@gmx.net> wrote:

the docs for ApCreateDBWidgetFamily() aren’t completely correct, because
they say, you have to invoke ApCreateDBWidget() for the container and all
child-widgets of the container in order to get access to the
widget-pointers…

The intention was to say that you’d need to create the widget one at a
time using ApCreateDBWidget(), instead of calling
ApCreateDBWidgetFamily(). I agree that adding the word “instead” would
make it clearer…

if i do so and give the function a parent argument, i insert a new widget
into widget-tree and if i use a null parent argument app crashes, so the
docs should say you have to invoke ApCreateWidget() instead of
ApCreateDBWidget() to get that behaviour

No they shouldn’t. ApCreateWidget() calls ApCreateDBWidget() anyway.

What the docs should mention though is that only disjoint widgets
(PtWindow, PtMenu, PtRegion) are allowed not to have a parent. If you
try to create a non-disjoint widget with no parent, ApCreateDBWidget()
should fail and return NULL. But there seems to be a hole in the error
checking code, and it returns a bad widget instead. Most likely, that’s
what’s causing the crash.

Wojtek Lerch wrote:

mirtch <> mirtch@gmx.net> > wrote:

the docs for ApCreateDBWidgetFamily() aren’t completely correct, because
they say, you have to invoke ApCreateDBWidget() for the container and all
child-widgets of the container in order to get access to the
widget-pointers…


The intention was to say that you’d need to create the widget one at a
time using ApCreateDBWidget(), instead of calling
ApCreateDBWidgetFamily(). I agree that adding the word “instead” would
make it clearer…


if i do so and give the function a parent argument, i insert a new widget
into widget-tree and if i use a null parent argument app crashes, so the
docs should say you have to invoke ApCreateWidget() instead of
ApCreateDBWidget() to get that behaviour


No they shouldn’t. ApCreateWidget() calls ApCreateDBWidget() anyway.

What the docs should mention though is that only disjoint widgets
(PtWindow, PtMenu, PtRegion) are allowed not to have a parent. If you
try to create a non-disjoint widget with no parent, ApCreateDBWidget()
should fail and return NULL. But there seems to be a hole in the error
checking code, and it returns a bad widget instead. Most likely, that’s
what’s causing the crash.
\

i’m still a bit unclear of the following: let’s say i have some .wgtd
file and a want to create an instance of that dialog with some given
parent. now, if i want to access all the ABW_
pointers of this dialog
what should i do? normally they are NULL after
ApCreateDBWidgetFamily()… as it is mentioned in the docs i have to
invoke ApCreateWidget() for all these pointers or how can i do this?

user@domain.invalid wrote:

i’m still a bit unclear of the following: let’s say i have some .wgtd
file and a want to create an instance of that dialog with some given
parent. now, if i want to access all the ABW_
pointers of this dialog
what should i do? normally they are NULL after
ApCreateDBWidgetFamily()… as it is mentioned in the docs i have to
invoke ApCreateWidget() for all these pointers or how can i do this?

If you just need to create a complete dialog with a specific parent,
ApModuleParent() followed by ApCreateModule() is the best way. No need
to deal with widget databases and ApCreate[DB]WidgetFamily.

Wojtek Lerch wrote:

user@domain.invalid > wrote:
i’m still a bit unclear of the following: let’s say i have some .wgtd
file and a want to create an instance of that dialog with some given
parent. now, if i want to access all the ABW_
pointers of this dialog
what should i do? normally they are NULL after
ApCreateDBWidgetFamily()… as it is mentioned in the docs i have to
invoke ApCreateWidget() for all these pointers or how can i do this?

If you just need to create a complete dialog with a specific parent,
ApModuleParent() followed by ApCreateModule() is the best way. No need
to deal with widget databases and ApCreate[DB]WidgetFamily.

thanks for reply!
and how do i import a container of such a module file, maybe a panel and
the panel’s children subtree?

mirtch <mirtch@gmx.net> wrote:

Wojtek Lerch wrote:
If you just need to create a complete dialog with a specific parent,
ApModuleParent() followed by ApCreateModule() is the best way. No need
to deal with widget databases and ApCreate[DB]WidgetFamily.

thanks for reply!
and how do i import a container of such a module file, maybe a panel and
the panel’s children subtree?

If you need to create a selected subset of a module’s widgets, you have
to open it as a database and use either ApCreateDBWidget() or
ApCreateDBWidgetFamily(). But as you already know, those functions
don’t set the ABW pointers.

An alternative would be to take the selected widgets out of the dialog,
and turn them into a separate picture module. Then you’d be able to use
ApCreateModule(), which does set the ABWs.