# # Combobox bindings. # # <>: # # Need to set [wm transient] just before mapping the popdown # instead of when it's created, in case a containing frame # has been reparented [#1818441]. # # On Windows: setting [wm transient] prevents the parent # toplevel from becoming inactive when the popdown is posted # (Tk 8.4.8+) # # On X11: WM_TRANSIENT_FOR on override-redirect windows # may be used by compositing managers and by EWMH-aware # window managers (even though the older ICCCM spec says # it's meaningless). # # On OSX: [wm transient] does utterly the wrong thing. # Instead, we use [MacWindowStyle "help" "noActivates hideOnSuspend"]. # The "noActivates" attribute prevents the parent toplevel # from deactivating when the popdown is posted, and is also # necessary for "help" windows to receive mouse events. # "hideOnSuspend" makes the popdown disappear (resp. reappear) # when the parent toplevel is deactivated (resp. reactivated). # (see [#1814778]). Also set [wm resizable 0 0], to prevent # TkAqua from shrinking the scrollbar to make room for a grow box # that isn't there. # # In order to work around other platform quirks in TkAqua, # [grab] and [focus] are set in bindings instead of # immediately after deiconifying the window. # namespace eval ttk::combobox { variable Values ;# Values($cb) is -listvariable of listbox widget variable State set State(entryPress) 0 } ### Combobox bindings. # # Duplicate the Entry bindings, override if needed: # ttk::copyBindings TEntry TCombobox bind TCombobox { ttk::combobox::Post %W } bind TCombobox { ttk::combobox::Unpost %W } bind TCombobox { ttk::combobox::Press "" %W %x %y } bind TCombobox { ttk::combobox::Press "s" %W %x %y } bind TCombobox { ttk::combobox::Press "2" %W %x %y } bind TCombobox { ttk::combobox::Press "3" %W %x %y } bind TCombobox { ttk::combobox::Drag %W %x } bind TCombobox { ttk::combobox::Motion %W %x %y } ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W] bind TCombobox <> { ttk::combobox::TraverseIn %W } ### Combobox listbox bindings. # bind ComboboxListbox { ttk::combobox::LBSelected %W } bind ComboboxListbox { ttk::combobox::LBSelected %W } bind ComboboxListbox { ttk::combobox::LBCancel %W } bind ComboboxListbox { ttk::combobox::LBTab %W next } bind ComboboxListbox <> { ttk::combobox::LBTab %W prev } bind ComboboxListbox { ttk::combobox::LBCleanup %W } bind ComboboxListbox { ttk::combobox::LBHover %W %x %y } bind ComboboxListbox { focus -force %W } switch -- [tk windowingsystem] { win32 { # Dismiss listbox when user switches to a different application. # NB: *only* do this on Windows (see #1814778) bind ComboboxListbox { ttk::combobox::LBCancel %W } } } ### Combobox popdown window bindings. # bind ComboboxPopdown { ttk::combobox::MapPopdown %W } bind ComboboxPopdown { ttk::combobox::UnmapPopdown %W } bind ComboboxPopdown