vanilla icon indicating copy to clipboard operation
vanilla copied to clipboard

setShowFocusRing for vanilla controls

Open typemytype opened this issue 7 years ago • 3 comments

instead of divining into a pond of NS-objects a convenient method for vanilla objects switching on off the focus ring

typemytype avatar May 13 '18 19:05 typemytype

Shortcut for:

obj.setFocusRingType_(NSFocusRingTypeNone)

Maybe it should be setDrawFocusRing since vanilla.List has a drawFocusRing argument.

typesupply avatar May 13 '18 19:05 typesupply

For the "on" state, should we be able to distinguish between NSFocusRingTypeDefault and NSFocusRingTypeExterior? I'm not quite sure what the difference is.

justvanrossum avatar May 14 '18 07:05 justvanrossum

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

typemytype avatar May 14 '18 14:05 typemytype

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()

typesupply avatar Dec 20 '23 15:12 typesupply