0

I wanna implement a custom TextField and its behavior just like NSDatePicker with its own data format, like 00:00:10:25

enter image description here

The requirement is as following:

  1. It should select text like NSDatePicker.
  2. Support the same mouse and keyboard operation, such as changing select when key or is pressed, adjusting value when or is pressed...and so on.

This is what I want to implement:

enter image description here

I'll appreciate so much if someone could guide me how to implement it, or give me some hint.

  • 1
    And exactly what have you tried? – chirag90 Sep 11 '19 at 10:15
  • @chirag90 I have tried subclassing NSTextField and implement NSTextViewDelegate to achieve select like NSDatePicker. But there are still some issues I can't resolve. – Yueh-Ming Chien Sep 11 '19 at 10:45
  • 1
    show you code and what error you are getting – chirag90 Sep 11 '19 at 10:46
  • Try to implement a UIPickerView instead of UITextField. Here is a nice tutorial: https://codewithchris.com/uipickerview-example/ – LukeSideWalker Sep 13 '19 at 01:04
  • It seems to me that obvious choices are to (1) subclass NSDatePicker to change its behavior, or (2) subclass NSTokenField to try to add in DatePicker type functionality. The latter seems more feasible, if you can figure out how to connect an incrementor to the selected token. – Ted Wrigley Sep 15 '19 at 23:27

0 Answers0