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