Menu

How to have a (-) icon on a single item in TUITableView

Chris
2014-04-03
2014-04-04
  • Chris

    Chris - 2014-04-03

    Hi
    When the TUITableView.Options.Editions.CellEdit = true and TUITableView.Options.Editions.EditAll = true, all the rows shows the (-) on the left hand side.

    How can i set a particular row to show the (-) icon only so that the user can delete that row.

    Please advise
    thanks
    chris

     
  • Diego

    Diego - 2014-04-03

    Hi Chris:

    Each item in a TUITableView has two properties:

    -EditingAccesoryType: Which controls if the accesory (Right side indicator) is shown.
    -EditingStyle: Wich controls what is shown in Edit mode on the left side of the item.

    The second one is what you are looking for. Just put that property to "tvesNone" for each item except for the item you want the (-) button appears.

    Hope it helps

    Greetings

     
  • Chris

    Chris - 2014-04-03

    Thanks diego.
    Do you mean

    UITableView.Options.Edition.CellEdit := true;
    UITableView.Options.Edition.EditAll := true;
    for each item in UITableView do begin
    if item <> delete_item
    item.EditingStyle := tvesNone
    end;

    please advise

    thanks
    chris

     
  • Diego

    Diego - 2014-04-03

    Hi Chris:

    I suggest you set the property Item.EditingStyle to tvesNone during items creation, or, at least, before you start the edition with the commands:

    UITableView.Options.Edition.CellEdit := true;
    UITableView.Options.Edition.EditAll := true;

    Greetings

     
  • Chris

    Chris - 2014-04-03

    Thanks diego.
    I will try it out.

    Thanks
    chris

     
  • Chris

    Chris - 2014-04-04

    Hi Diego
    When the delete button appears and the user pressed the delete button, the OnItemDelete event will be triggered.
    So, in this event, it will delete the record in the database. If the deletion of record in the database is unsuccessful, how can i restore the item back to the table again? or how can i don't allow the table to remove that item?

    please advise
    thanks
    chris

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.