Menu

Infinite Depth in a DPFUITableView

2013-11-04
2013-11-05
  • Pierre Moati

    Pierre Moati - 2013-11-04

    Hello,
    I'm currently using a TDPFNavigationController with 2 pages. The first one is a list for search, and the second one is a "detail view" of the item selected (as in adressbook for example).

    When I click on a product, i select a product, as you can do that in your adressbook to select a person.

    In my case, I have some datas about the product, but my last section is a list os associated products. And if I click in one of the associated product, the product is showing (I want to show the same animation as when I change the page of the NavigationController, and if it's virtual).
    In the new product, I can select another associated product, which could be the same as the first !
    That's why I mentionned about infinite depth :D
    Forthemore, I think if could be hard to get the path from first element to current element, so when I click on the "back" button, it's just go back to the searchPage.

    Feel free to see the picture attached because it's very useful to understand what I want to do :)

    Is there a way to do that ? Thanks !

     
  • Pierre Moati

    Pierre Moati - 2013-11-04

    This is the attachment :)

     
  • Fenistil

    Fenistil - 2013-11-04

    Hi!

    I can't test it now, but if the NavController doesn't allow to Pop a page that already has been popped, I think you should use 4 pages. Lets call the first page "PageA" the second "PageB". So you will have PageA1, PageA2, PageB1, PageB2. When the user tap an item in PageA1 load PageB1. After that load PageA2 and pop out from the NavController the PageA1. From here load PageB2 and pop out PageB1. Now you can load again the PageA1. For going back, I think you'd better make a custom button and do the same backwards.

    Regards

     
  • Pierre Moati

    Pierre Moati - 2013-11-04

    Hello,
    thank you for your reply Fenistil...
    I think the better way should be to create an extended class herited from a TDPFNavigationControllerPage, and push it on the fly.

    I found this code in Objective-C which is a similar method :

    SameClassAsSelf *new_self = [[SameClassAsSelf alloc] init...];
    new_self.questionNumber = QuestionNumber;
    new_self.questionsList = QuestionsList; //if needed
    [self pushViewController:new_self animated:YES];
    [new_self release];
    

    Is there a way to retrieve a page already created in designtime, and duplicate it on runtime ? I'm affraid there is no solution to do that... But If I can create a exended class from TDPFNavigationControllerPage, I think this is a good way. Do you agree ?

    Sorry, I'm not coding Delphi since 8 years, so it's a bit rusted :D

     

    Last edit: Pierre Moati 2013-11-04
  • Fenistil

    Fenistil - 2013-11-04

    As I know Delphi doesn't have a method to duplicate an object, instead of you can create a new one and copy all of the properties and sub-controls of it to the new one. (The ObjC code do the same.) But don't know if it'd work, since the NavigationController has a stack and I don't know what happens when you try to push a Page that created on-the-fly and release another one that is in the stack. However all the Pages you created will have a global variable, so you can simply call them Form1.NavPage1 for example.

     
  • Pierre Moati

    Pierre Moati - 2013-11-05

    Thank you Fenistil.
    I think you bring me on the right way :

    So, I use a Frame ! I have the advantage easily creating the frame in designtime, and the opportunity to use it in runtime. By this way my frame is created on the fly. I'm not sure this is really good for the memory because it's create and destroy a frame... The butter way should be to reuse the frame, but create/destroy are done interally in a babak's class.

    My code :

    procedure TMainForm.elementsItemSelect(Sender: TObject; Section, RowNo: Integer;
      var CellAccessory: TTableViewCellAccessory);
    var newPage:TDPFNavigationControllerPage;
    begin
    
     newPage := TDPFNavigationControllerPage.Create( elements );
     newPage.Frame := TProductPageFrame;
     newFrale
     PageController.InsertPage( newPage );
     PageController.PushViewController( newPage, true );
    

    It will be better to have the opportunity to assign a frame if needed. So, it will be possible to reuse an object instead of creating it.

     

    Last edit: Pierre Moati 2013-11-05

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.