def focus2_clicked(obj, item=None): win = StandardWindow("focus2", "Focus 2", autodel=True, size=(400, 400)) win.focus_highlight_enabled = True bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() PARENT = bx en = Entry(PARENT, scrollable=True, single_line=True, text="Entry that should get focus", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() bt = Button(PARENT, text="Give focus to entry") bt.callback_clicked_add(_focus_obj, en) bx.pack_end(bt) bt.show() ly = Layout(PARENT, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "layout" bx.pack_end(ly) ly.show() bt1 = bt = Button(ly, text="Button 1") ly.part_content_set("element1", bt) en1 = Entry(ly, scrollable=True, single_line=True, text="Scrolled Entry that should get focus", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ ) ly.part_content_set("element2", en1) bt = Button(ly, text="Button 2") ly.part_content_set("element3", bt) bt = Button(PARENT, text="Give focus to layout", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, ly) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout part", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_layout_part, ly) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout 'Button 1'", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, bt1) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout 'Entry'", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, en1) bx.pack_end(bt) bt.show() bt.focus_next_object_set(en, ELM_FOCUS_DOWN) en.focus_next_object_set(bt, ELM_FOCUS_UP) win.show()
def focus2_clicked(obj, item=None): win = StandardWindow("focus2", "Focus 2", autodel=True, size=(400, 400)) win.focus_highlight_enabled = True bx = Box(win, size_hint_weight=EXPAND_BOTH) win.resize_object_add(bx) bx.show() PARENT = bx en = Entry(PARENT, scrollable=True, single_line=True, text="Entry that should get focus", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bx.pack_end(en) en.show() bt = Button(PARENT, text="Give focus to entry") bt.callback_clicked_add(_focus_obj, en) bx.pack_end(bt) bt.show() ly = Layout(PARENT, size_hint_weight=EXPAND_BOTH) ly.file = edj_file, "layout" bx.pack_end(ly) ly.show() bt1 = bt = Button(ly, text="Button 1") ly.part_content_set("element1", bt) en1 = Entry(ly, scrollable=True, single_line=True, text="Scrolled Entry that should get focus", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) ly.part_content_set("element2", en1) bt = Button(ly, text="Button 2") ly.part_content_set("element3", bt) bt = Button(PARENT, text="Give focus to layout", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, ly) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout part", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_layout_part, ly) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout 'Button 1'", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, bt1) bx.pack_end(bt) bt.show() bt = Button(PARENT, text="Give focus to layout 'Entry'", size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ) bt.callback_clicked_add(_focus_obj, en1) bx.pack_end(bt) bt.show() bt.focus_next_object_set(en, ELM_FOCUS_DOWN) en.focus_next_object_set(bt, ELM_FOCUS_UP) win.show()