Forum Archive

Shut off "swipe to delete" with list_dialogs

donnieh

Can swipe to delete be turned off? I ask because I want to use it as a read only list.

import dialogs
list = ['Apple', 'Orange', 'Pear']
selected = dialogs.list_dialog(title='Fruit', items=list, multiple=False)
donnieh

If the swipe to delete feature cannot be removed, I will embrace it. How can list be edited/updated after an item is deleted?

omz

This looks like a bug to me. The list shouldn't be editable, I'll look into it.

omz

Definitely a bug, here's a quick workaround for now:

import dialogs

def list_dialog(title='', items=None, multiple=False, done_button_title='Done'):
    c = dialogs._ListDialogController(title, items, multiple, done_button_title=done_button_title)
    c.view.data_source.delete_enabled = False
    c.view.present('sheet')
    c.view.wait_modal()
    return c.selected_item
donnieh

Ok, great. Thank you for your time!