TableView: Back button

Hi,

is there a way to detect that the detailview is visible (together with the back button) and then to programmatically call the back button so that the back button disappears and the calling main view is visible?

Kind regards
gernot

Hi, 


Yes, there should be a public function isDetailMode and then you can use the item HideDetailView method to return:

TMSFMXTableView1.Items[0].HideDetailView;

Kind Regards, 
Pieter

Perfect - Thanks

Hi Pieter,

after further tests with

if tvMediaDetail.isDetailMode then
  begin
    tvMediaDetail.SelectedItem.HideDetailView;
  end;

I always get an access violation after the detailview is hidden. Is this a bug or is there an issue with my call to HideDetailView?

Kind regards
Gernot

Can you verify if SelectedItem is assigned?


Kind Regards, 
Pieter

Yes. I modified the code as follows:

if tvMediaDetail.isDetailMode then
  begin
    test := tvMediaDetail.SelectedItem;
    if Assigned(test) then
                  tvMediaDetail.SelectedItem.HideDetailView;
  end;
tvMediaDetail.Categories.Clear;
tvMediaDetail.Items.Clear;

The access violation occurs because of the following two lines as I need to clear the tableview afterwards. I put those lines now in a BeginUpdate..EndUpdate and this seems to solve the problem

Thanks
gernot

Yes, for runtime updates, always use beginupdate/endupdate:

http://tmssoftware.com/site/tmsfmxpack.asp?s=faq&show=565

Kind Regards, 
Pieter