vanilla
vanilla copied to clipboard
setShowFocusRing for vanilla controls
instead of divining into a pond of NS-objects a convenient method for vanilla objects switching on off the focus ring
Shortcut for:
obj.setFocusRingType_(NSFocusRingTypeNone)
Maybe it should be setDrawFocusRing since vanilla.List has a drawFocusRing argument.
For the "on" state, should we be able to distinguish between NSFocusRingTypeDefault and NSFocusRingTypeExterior? I'm not quite sure what the difference is.
I dont see a difference between those...
import AppKit
import vanilla
w = vanilla.Window((400, 400))
w.t1 = vanilla.List((10, 10, -10, 100), [])
w.t2 = vanilla.List((10, 120, -10, 100), [])
w.t3 = vanilla.List((10, 230, -10, 100), [])
w.t1._tableView.setFocusRingType_(AppKit.NSFocusRingTypeDefault)
w.t2._tableView.setFocusRingType_(AppKit.NSFocusRingTypeNone)
w.t3._tableView.setFocusRingType_(AppKit.NSFocusRingTypeExterior)
w.open()
I would go for NSFocusRingTypeDefault and NSFocusRingTypeNone as True and False
I added setShowFocusRing to vanillaBase.
import AppKit
import vanilla
w = vanilla.Window((400, 300))
w.l = vanilla.List((10, 10, -10, 50), "List")
w.l2 = vanilla.List((10, 70, -10, 50), "List2")
w.et = vanilla.EditText((10, 130, -10, 22), "EditText")
w.cb = vanilla.ComboBox((10, 160, -10, 22), list("ComboBox"))
w.te = vanilla.EditText((10, 190, -10, 50), "TextEditor")
w.l.setShowFocusRing(False)
w.l2.setShowFocusRing(False)
w.et.setShowFocusRing(False)
w.cb.setShowFocusRing(False)
w.te.setShowFocusRing(False)
w.open()