PtSetResource after ApCreateDBWidget

Hello out there,
I like to build an application without PhAB because I need a lot of
flexibility both at startup and runtime. But I also like to use PhAB as
an editor for forms. So I use a piece of code similar to this:

// Copied from an PhAB generated file, needed for liking against libAp:
ApWidget_t AbWidgets[ 36 ];

static const ApClassTab_t ClassTable[] = {
{ “PtWindow”, &PtWindow },
{ “PtImageArea”, &PtImageArea },
{ “PtLabel”, &PtLabel },
{ “PtButton”, &PtButton },
{ “PtRaw”, &PtRaw },
{ “PtPane”, &PtPane },
{ NULL, NULL }
};

ApContext_t AbContext = { ClassTable, 1, AbWidgets };

// the truly needed piece of code
int main(int argc, char *argv[]) {
PtInit(NULL);
ApDBase_t *pDB = ApOpenDBaseFile(“test.wgtw”);
PtWidget_t *pQNXWidget = ApCreateDBWidget(pDB, “base”, NULL, NULL, 0,
NULL);
// In real code needed to set a callback
PtSetResource(pQNXWidget, Pt_ARG_FILL_COLOR, 0x00FF0000,
sizeof(int));
cout << “all done\n”;
return 0;
}

When I run this (whith “base” as the first widget in the
'test.wgtw’which is a window) I’ll get a SIGSEGV while setting the
resource. Is there a proper way to set resources not using the
ApCreateDBWidget function?
Dominik

Do you know there is a function in phAb which generate a source fragment for
a defined ApWgtClass. If you do this you do not need the phab stuff at al.
Just take a look at the menu(popup).


Bye Sascha( sascha@bitctrl.de )

Sascha Morgenstern
BitCtrl Systems GmbH
Weißenfelser Straße 67
Germany - 04229 Leipzig
Phon. +49 341 490 670
FAX. +49 341 490 67 15
eMail: sascha@bitctrl.de
WWW: http://www.bitctrl.de


Dominik Diesch <Dominik.Diesch@gmx.net> schrieb in im Newsbeitrag:
3AD4ED57.B458ED49@gmx.net

Hello out there,
I like to build an application without PhAB because I need a lot of
flexibility both at startup and runtime. But I also like to use PhAB as
an editor for forms. So I use a piece of code similar to this:

// Copied from an PhAB generated file, needed for liking against libAp:
ApWidget_t AbWidgets[ 36 ];

static const ApClassTab_t ClassTable[] = {
{ “PtWindow”, &PtWindow },
{ “PtImageArea”, &PtImageArea },
{ “PtLabel”, &PtLabel },
{ “PtButton”, &PtButton },
{ “PtRaw”, &PtRaw },
{ “PtPane”, &PtPane },
{ NULL, NULL }
};

ApContext_t AbContext = { ClassTable, 1, AbWidgets };

// the truly needed piece of code
int main(int argc, char *argv[]) {
PtInit(NULL);
ApDBase_t *pDB = ApOpenDBaseFile(“test.wgtw”);
PtWidget_t *pQNXWidget = ApCreateDBWidget(pDB, “base”, NULL, NULL, 0,
NULL);
// In real code needed to set a callback
PtSetResource(pQNXWidget, Pt_ARG_FILL_COLOR, 0x00FF0000,
sizeof(int));
cout << “all done\n”;
return 0;
}

When I run this (whith “base” as the first widget in the
'test.wgtw’which is a window) I’ll get a SIGSEGV while setting the
resource. Is there a proper way to set resources not using the
ApCreateDBWidget function?
Dominik

Thanks for your reply,
but I think that my last sentence was a bit misleading. I like to use the
ApCreateDBWidget function but I have to set some resources after I read the
widget. And doing so causes the SIGSEGV in libph. And my question is: what do I
have to do so that this widget from the database behaves like a manually created
widget (in particular no SIGSEGV at the call to PtSetResource)
Dominik

Sascha Morgenstern schrieb:

Do you know there is a function in phAb which generate a source fragment for
a defined ApWgtClass. If you do this you do not need the phab stuff at al.
Just take a look at the menu(popup).


Bye Sascha( > sascha@bitctrl.de > )

Sascha Morgenstern
BitCtrl Systems GmbH
Weißenfelser Straße 67
Germany - 04229 Leipzig
Phon. +49 341 490 670
FAX. +49 341 490 67 15
eMail: > sascha@bitctrl.de
WWW: > http://www.bitctrl.de

Dominik Diesch <> Dominik.Diesch@gmx.net> > schrieb in im Newsbeitrag:
3AD4ED57.B458ED49@gmx.net> …
Hello out there,
I like to build an application without PhAB because I need a lot of
flexibility both at startup and runtime. But I also like to use PhAB as
an editor for forms. So I use a piece of code similar to this:

// Copied from an PhAB generated file, needed for liking against libAp:
ApWidget_t AbWidgets[ 36 ];

static const ApClassTab_t ClassTable[] = {
{ “PtWindow”, &PtWindow },
{ “PtImageArea”, &PtImageArea },
{ “PtLabel”, &PtLabel },
{ “PtButton”, &PtButton },
{ “PtRaw”, &PtRaw },
{ “PtPane”, &PtPane },
{ NULL, NULL }
};

ApContext_t AbContext = { ClassTable, 1, AbWidgets };

// the truly needed piece of code
int main(int argc, char *argv[]) {
PtInit(NULL);
ApDBase_t *pDB = ApOpenDBaseFile(“test.wgtw”);
PtWidget_t *pQNXWidget = ApCreateDBWidget(pDB, “base”, NULL, NULL, 0,
NULL);
// In real code needed to set a callback
PtSetResource(pQNXWidget, Pt_ARG_FILL_COLOR, 0x00FF0000,
sizeof(int));
cout << “all done\n”;
return 0;
}

When I run this (whith “base” as the first widget in the
'test.wgtw’which is a window) I’ll get a SIGSEGV while setting the
resource. Is there a proper way to set resources not using the
ApCreateDBWidget function?
Dominik

Ohhh, I’m sorry, the solution to the riddle of the SIGSEGV is easy: ApGreateDBWidget
simply fails and I receive a null pointer… The problem was that retrieving infos
with the ApGetDBWidgetInfo works without complaints and I errorneously concluded the
next function will succeed too :frowning:
But the question remains: how can I read in resources from a Photon DB without
making a full blown PhAB application? Since reading a resource works from within a
PhAB application I have to simulate one…


Dominik Diesch schrieb:

Thanks for your reply,
but I think that my last sentence was a bit misleading. I like to use the
ApCreateDBWidget function but I have to set some resources after I read the
widget. And doing so causes the SIGSEGV in libph. And my question is: what do I
have to do so that this widget from the database behaves like a manually created
widget (in particular no SIGSEGV at the call to PtSetResource)
Dominik

Sascha Morgenstern schrieb:

Do you know there is a function in phAb which generate a source fragment for
a defined ApWgtClass. If you do this you do not need the phab stuff at al.
Just take a look at the menu(popup).


Bye Sascha( > sascha@bitctrl.de > )

Sascha Morgenstern
BitCtrl Systems GmbH
Weißenfelser Straße 67
Germany - 04229 Leipzig
Phon. +49 341 490 670
FAX. +49 341 490 67 15
eMail: > sascha@bitctrl.de
WWW: > http://www.bitctrl.de

Dominik Diesch <> Dominik.Diesch@gmx.net> > schrieb in im Newsbeitrag:
3AD4ED57.B458ED49@gmx.net> …
Hello out there,
I like to build an application without PhAB because I need a lot of
flexibility both at startup and runtime. But I also like to use PhAB as
an editor for forms. So I use a piece of code similar to this:

// Copied from an PhAB generated file, needed for liking against libAp:
ApWidget_t AbWidgets[ 36 ];

static const ApClassTab_t ClassTable[] = {
{ “PtWindow”, &PtWindow },
{ “PtImageArea”, &PtImageArea },
{ “PtLabel”, &PtLabel },
{ “PtButton”, &PtButton },
{ “PtRaw”, &PtRaw },
{ “PtPane”, &PtPane },
{ NULL, NULL }
};

ApContext_t AbContext = { ClassTable, 1, AbWidgets };

// the truly needed piece of code
int main(int argc, char *argv[]) {
PtInit(NULL);
ApDBase_t *pDB = ApOpenDBaseFile(“test.wgtw”);
PtWidget_t *pQNXWidget = ApCreateDBWidget(pDB, “base”, NULL, NULL, 0,
NULL);
// In real code needed to set a callback
PtSetResource(pQNXWidget, Pt_ARG_FILL_COLOR, 0x00FF0000,
sizeof(int));
cout << “all done\n”;
return 0;
}

When I run this (whith “base” as the first widget in the
'test.wgtw’which is a window) I’ll get a SIGSEGV while setting the
resource. Is there a proper way to set resources not using the
ApCreateDBWidget function?
Dominik