Sets the current focus to be on this element :param force: if True will call focus_force otherwise calls focus_set :type force: bool
(self, force=False)
| 1513 | |
| 1514 | |
| 1515 | def set_focus(self, force=False): |
| 1516 | """ |
| 1517 | Sets the current focus to be on this element |
| 1518 | |
| 1519 | :param force: if True will call focus_force otherwise calls focus_set |
| 1520 | :type force: bool |
| 1521 | """ |
| 1522 | if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow |
| 1523 | return |
| 1524 | try: |
| 1525 | if force: |
| 1526 | self.Widget.focus_force() |
| 1527 | else: |
| 1528 | self.Widget.focus_set() |
| 1529 | except Exception as e: |
| 1530 | _error_popup_with_traceback("Exception blocking focus. Check your element's Widget", e) |
| 1531 | |
| 1532 | def block_focus(self, block=True): |
| 1533 | """ |
no test coverage detected