Adding a checkbox to a form | developer.brewmp.com Adding a checkbox to a form | developer.brewmp.com

Developer

Adding a checkbox to a form

I have created a form and I am trying to attach to it a checkbox and a textbox. However I can successfully display the textbox on the form, but not the checkbox. Here is my code:

IPropContainer *pIPropContainer = NULL;
IWidget *pWPropContainer = NULL;
IWidget *pWDateTxtBox = NULL;
IWidget *pWCheck = NULL;

ISHELL_CreateInstance(pIShell, AEECLSID_PROPCONTAINER, (void**) &pIPropContainer);
ISHELL_CreateInstance(pIShell, AEECLSID_STATICWIDGET, (void**) &pWPropContainer);
ISHELL_CreateInstance(pIShell, AEECLSID_CHECKWIDGET, (void **)&(pWCheck));
ISHELL_CreateInstance(pIShell, AEECLSID_TEXTWIDGET, (void **)&pWDateTxtBox);

IWIDGET_SetLayoutStyle(pWPropContainer, LAYOUT_VERT);
IWIDGET_SetBorderColor(pWPropContainer, RGB_BLACK);

IPROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, NULL);
IPROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, NULL);

IPROPCONTAINER_QueryInterface(pIPropContainer, AEEIID_WIDGET, (void**)&pWPropContainer);
IFORM_SetWidget(pForm, WID_FORM, pWPropContainer);

I can see the textbox but not the checkbox. Any help will be greatly appriciated.

I think this is the problem
IPROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, NULL);
IPROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, NULL);
the last parameter is NULL instead use the property WidgetProp like this
WidgetProp wp;
wp.prop = 10;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, (WidgetProp*)&wp);
wp.prop = 40;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, (WidgetProp*)&wp);

I think this is the problem
IPROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, NULL);
IPROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, NULL);
the last parameter is NULL instead use the property WidgetProp like this
WidgetProp wp;
wp.prop = 10;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, (WidgetProp*)&wp);
wp.prop = 40;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, (WidgetProp*)&wp);

Thanks! That seem to fix that problem, but now I have another one. The textbox is all the way at the bottom, not just below the checkbox. And also I am unable to edit the textbox. Any idea?

Thanks! That seem to fix that problem, but now I have another one. The textbox is all the way at the bottom, not just below the checkbox. And also I am unable to edit the textbox. Any idea?

IPROPCONTAINER_QueryInterface(pIPropContainer, AEEIID_WIDGET,
(void**)&pIWidget);
IWIDGET_SetProperty(pIWidget, PROP_LAYOUTSTYLE, LAYOUT_HORZ);
wp.prop = 1;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, (WidgetProp*)&wp);
wp.prop = 1;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, (WidgetProp*)&wp);

IPROPCONTAINER_QueryInterface(pIPropContainer, AEEIID_WIDGET,
(void**)&pIWidget);
IWIDGET_SetProperty(pIWidget, PROP_LAYOUTSTYLE, LAYOUT_HORZ);
wp.prop = 1;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWCheck, WIDGET_ZNORMAL, (WidgetProp*)&wp);
wp.prop = 1;
wp.bVisible = TRUE;
PROPCONTAINER_Insert(pIPropContainer, pWDateTxtBox, WIDGET_ZNORMAL, (WidgetProp*)&wp);