MCPcopy Create free account
hub / github.com/mhammond/pywin32 / PyCButton_create_window

Function PyCButton_create_window

Pythonwin/win32control.cpp:92–126  ·  view source on GitHub ↗

@pymethod |PyCButton|CreateWindow|Creates the window for a new button object.

Source from the content-addressed store, hash-verified

90
91// @pymethod |PyCButton|CreateWindow|Creates the window for a new button object.
92static PyObject *
93PyCButton_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.
129static PyObject *

Callers

nothing calls this directly

Calls 3

GetWndPtrFunction · 0.85
GetButtonFunction · 0.85
CreateMethod · 0.45

Tested by

no test coverage detected