def _DoSize(self, cx, cy, repaint=1): # right-justify the textbox. ctrl = win32gui.GetDlgItem(self.hwnd, IDC_SEARCHTEXT) l, t, r, b = win32gui.GetWindowRect(ctrl) l, t = win32gui.ScreenToClient(self.hwnd, (l, t)) r, b = win32gui.ScreenToClient(self.hwnd, (r, b)) win32gui.MoveWindow(ctrl, l, t, cx - l - 5, b - t, repaint) # The button. ctrl = win32gui.GetDlgItem(self.hwnd, IDC_BUTTON_OK) l, t, r, b = win32gui.GetWindowRect(ctrl) l, t = win32gui.ScreenToClient(self.hwnd, (l, t)) r, b = win32gui.ScreenToClient(self.hwnd, (r, b)) w = r - l win32gui.MoveWindow(ctrl, cx - 5 - w, t, w, b - t, repaint)
def OnInitDialog(self, hwnd, msg, wparam, lparam): self.hwnd = hwnd # centre the dialog desktop = win32gui.GetDesktopWindow() l, t, r, b = win32gui.GetWindowRect(self.hwnd) dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop) centre_x, centre_y = win32gui.ClientToScreen(desktop, ((dt_r - dt_l) // 2, (dt_b - dt_t) // 2)) win32gui.MoveWindow(hwnd, centre_x - (r // 2), centre_y - (b // 2), r - l, b - t, 0) # self._SetupList() l, t, r, b = win32gui.GetClientRect(self.hwnd) self._DoSize(r - l, b - t, 1)
def on_init_dialog(self, hwnd, msg, wparam, lparam): self._hwnd = hwnd l, t = self._dialog_initial_position el, et, er, eb = self._get_edge_sizes() w = self._dialog_initial_size[0] + el + er h = self._dialog_initial_size[1] + et + eb win32gui.MoveWindow(self._hwnd, l, t, w, h, 0) l, t, r, b = win32gui.GetWindowRect(self._hwnd) w = r - l - el - er h = b - t - et - eb self._do_size(w, h, 1) self._post_init()
def _DoSize(self, cx, cy, repaint=1): # right-justify the textbox. # ctrl = win32gui.GetDlgItem(self.hwnd, IDC_JOB_NAME) # win32gui.SetWindowText(ctrl, self.job_name) # l, t, r, b = win32gui.GetWindowRect(ctrl) # l, t = win32gui.ScreenToClient(self.hwnd, (l, t)) # r, b = win32gui.ScreenToClient(self.hwnd, (r, b)) # win32gui.MoveWindow(ctrl, l, t, cx-l-5, b-t, repaint) ctrl = win32gui.GetDlgItem(self.hwnd, IDC_SCRIPT) win32gui.SetFocus(ctrl) # The button. ctrl = win32gui.GetDlgItem(self.hwnd, IDC_BUTTON_SUBMIT) l, t, r, b = win32gui.GetWindowRect(ctrl) l, t = win32gui.ScreenToClient(self.hwnd, (l, t)) r, b = win32gui.ScreenToClient(self.hwnd, (r, b)) w = r - l win32gui.MoveWindow(ctrl, cx - 5 - w, t, w, b - t, repaint)
def _do_size(self, width, height, repaint=1): for control in self._dialog_controls: l, t, w, h = control.calculate_size(width, height) win32gui.MoveWindow(control.handle, l, t, w, h, repaint)