@pymethod |PyCButton|CreateWindow|Creates the window for a new button object.
| 90 | |
| 91 | // @pymethod |PyCButton|CreateWindow|Creates the window for a new button object. |
| 92 | static PyObject * |
| 93 | PyCButton_create_window(PyObject *self, PyObject *args) |
| 94 | { |
| 95 | TCHAR *caption; |
| 96 | int style, id; |
| 97 | PyObject *obParent, *obcaption; |
| 98 | RECT rect; |
| 99 | if (!PyArg_ParseTuple(args, "Oi(iiii)Oi:CreateWindow", |
| 100 | &obcaption, // @pyparm string|caption||The caption (text) for the button. |
| 101 | &style, // @pyparm int|style||The style for the button. Use any of the win32con.BS_* constants. |
| 102 | &rect.left,&rect.top,&rect.right,&rect.bottom, |
| 103 | // @pyparm (left, top, right, bottom)|rect||The size and position of the button. |
| 104 | &obParent, // @pyparm <o PyCWnd>|parent||The parent window of the button. Usually a <o PyCDialog>. |
| 105 | &id )) // @pyparm int|id||The buttons control ID. |
| 106 | return NULL; |
| 107 | |
| 108 | if (!ui_base_class::is_uiobject(obParent, &PyCWnd::type)) |
| 109 | RETURN_TYPE_ERR("parent argument must be a window object"); |
| 110 | CWnd *pParent = GetWndPtr( obParent ); |
| 111 | if (pParent==NULL) |
| 112 | return NULL; |
| 113 | CButton *pBut = GetButton(self); |
| 114 | if (!pBut) |
| 115 | return NULL; |
| 116 | if (!PyWinObject_AsTCHAR(obcaption, &caption, FALSE)) |
| 117 | return NULL; |
| 118 | BOOL ok; |
| 119 | GUI_BGN_SAVE; |
| 120 | ok = pBut->Create(caption, style, rect, pParent, id ); |
| 121 | GUI_END_SAVE; |
| 122 | PyWinObject_FreeTCHAR(caption); |
| 123 | if (!ok) |
| 124 | RETURN_ERR("CButton::Create"); |
| 125 | RETURN_NONE; |
| 126 | } |
| 127 | |
| 128 | // @pymethod int|PyCButton|GetCheck|Retrieves the check state of a radio button or check box. |
| 129 | static PyObject * |