def _set_item(self, item_id, value):
        """Set the current value of an item in the dialog
        """
        item_hwnd = wrapped(win32gui.GetDlgItem, self.hwnd, item_id)
        class_name = wrapped(win32gui.GetClassName, item_hwnd)
        styles = wrapped(win32gui.GetWindowLong, self.hwnd, win32con.GWL_STYLE)
        if class_name == "Edit":
            if isinstance(value, datetime.date):
                value = value.strftime("%d %b %Y")
            value = unicode(value).replace("\r\n", "\n").replace("\n", "\r\n")
            wrapped(win32gui.SetDlgItemText, self.hwnd, item_id, value)
        elif class_name == "Button":
            #~ if styles & win32con.BS_CHECKBOX:
            SendMessage(item_hwnd, win32con.BM_SETCHECK, int(value), 0)
            #~ elif styles & win32con.BS_RADIOBUTTON:
        elif class_name == "ComboBox":
            for item in value:
                if isinstance(item, tuple):
                    item = item[0]
                SendMessage(item_hwnd, win32con.CB_ADDSTRING, 0, utils.string_as_pointer(str(item)))
            SendMessage(item_hwnd, win32con.CB_SETCURSEL, 0, 0)
        elif class_name == "Static":
            wrapped(win32gui.SetDlgItemText, self.hwnd, item_id, unicode(value))
        else:
            raise RuntimeError("Unknown class: %s" % class_name)
dataset/ETHPy150Open tjguk/winsys/winsys/dialogs.py/Dialog._set_item/original