New use_default_focus option for forms.
This commit is contained in:
parent
d3d154b870
commit
4667a2f3ff
|
@ -20,7 +20,7 @@ with sg.FlexForm('Realtime Keyboard Test', return_keyboard_events=True, use_defa
|
||||||
break
|
break
|
||||||
if button is not None:
|
if button is not None:
|
||||||
text_elem.Update(button)
|
text_elem.Update(button)
|
||||||
elif value is None:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ class FlexForm:
|
||||||
'''
|
'''
|
||||||
Display a user defined for and return the filled in data
|
Display a user defined for and return the filled in data
|
||||||
'''
|
'''
|
||||||
def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False):
|
def __init__(self, title, default_element_size=(DEFAULT_ELEMENT_SIZE[0], DEFAULT_ELEMENT_SIZE[1]), auto_size_text=None, auto_size_buttons=None, scale=(None, None), location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True):
|
||||||
self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT
|
self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT
|
||||||
self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS
|
self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS
|
||||||
self.Title = title
|
self.Title = title
|
||||||
|
@ -895,7 +895,7 @@ class FlexForm:
|
||||||
self.DictionaryKeyCounter = 0
|
self.DictionaryKeyCounter = 0
|
||||||
self.LastButtonClicked = None
|
self.LastButtonClicked = None
|
||||||
self.UseDictionary = False
|
self.UseDictionary = False
|
||||||
self.UseDefaultFocus = False
|
self.UseDefaultFocus = use_default_focus
|
||||||
self.ReturnKeyboardEvents = return_keyboard_events
|
self.ReturnKeyboardEvents = return_keyboard_events
|
||||||
self.LastKeyboardEvent = None
|
self.LastKeyboardEvent = None
|
||||||
|
|
||||||
|
@ -954,8 +954,10 @@ class FlexForm:
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not found_focus:
|
if not found_focus and self.UseDefaultFocus:
|
||||||
self.UseDefaultFocus = True
|
self.UseDefaultFocus = True
|
||||||
|
else:
|
||||||
|
self.UseDefaultFocus = False
|
||||||
# -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ##
|
# -=-=-=-=-=-=-=-=- RUN the GUI -=-=-=-=-=-=-=-=- ##
|
||||||
StartupTK(self)
|
StartupTK(self)
|
||||||
return self.ReturnValues
|
return self.ReturnValues
|
||||||
|
|
Loading…
Reference in New Issue