Forum Archive

ui.CheckBox?

zencuke

Is there an easy way to implement a ui checkbox control? I didn't find one on the ui doc class list. I was surprised.

zencuke

My best guess is a button that changes its image in the action. Are the empty box and checked box icons in the builtin images? Is there a list of the built ons somewhere?

ccc

http://omz-software.com/pythonista/docs/ios/ui.html#switch ?

zencuke

Thank you. I saw that. It is functionally what I need but I don't like the icon. Nothing is being switched. I need more like a selection operation. I should probably skip the button altogether and use the TableView.enable_multiple_selection property instead. I assume that will highlight a row.

At the high level I am mostly trying to implement a custom ListDataSource behavior with dated items where the items have multiple fields. I first tried packing all the data (including the date) into a single text string but I can't get a column like feel out of that interface. It looks better giving different fields their own fonts and I need control of where each field is displayed. So I am off in custom TableViewCell land.

Thanks again.

JonB

here is a simple CheckBox class.
It is a wrapper for a ui.Button, but with auto toggling X, and internal value property like a a Switch. action, enabled work as in Switch

You can customize the style by changing the display character, corner_radius, bg_color, etc. I didn't implement font yet, but you can acces the internal button _cb if needed.