locked
Trouble with Pageframe and active tabs RRS feed

  • Question

  • I have a pageframe with 8 pages, each page has a grid where I can update some data in a cursor. Every time when I change the active tab, I want to execute some code, but I don't want to write in each page's deactivate quite the same code, depending on the page I am leaving. The other point is, when I release my form the page's deactivate is not fired.

     

    I believed there was at the pageframe level an event that is fired when a new tab is activated, without having to write code in each of the possible pages. But there isn't. What can I do?


    WP
    Saturday, October 8, 2011 5:04 PM

Answers

  • Hi WP,

    as an alternative you could make use of BINDEVENTS(). Just bind each pages Activate event to a central pagehandler that holds your code that shall be executed.

    Just expand the code below to the number of pages within your pageframe.

    BINDEVENT( Thisform.Pageframe1.Page1 , [Activate] , Thisform , [PageHandler] , 0 )
    BINDEVENT( Thisform.Pageframe1.Page2 , [Activate] , Thisform , [PageHandler] , 0 )
    
    

    Now, add a method called i.e. 'Pagehandler' to your form and put your code in that method.


    Gruss / Best regards -Tom 010101100100011001010000011110000101001001101111011000110110101101110011
    • Proposed as answer by Naomi N Sunday, October 9, 2011 5:02 AM
    • Marked as answer by Kee Poppy Friday, October 14, 2011 8:40 AM
    Saturday, October 8, 2011 9:48 PM
    Answerer

All replies

  • Yes, the way exists and it is called Class. If you create a class for your Page object and use this class as a member object on your PageFrame then you don't need to write a code on each page.Activate method.

    To create the Page class use following command:

    CREATE CLASS MyPage OF MyNewClassLibrary AS Page 
    
    

    And to place this new class onto the PageFrame object simply change MemberClass property of your PageFrame object.

    Unfortunately, I still cannot help if some event isn't fired... Such thing you have to ask Microsoft.

    Alternately you may display almost all rising events in VFP Debug window and use the one which fits to your needs. It is much cheaper than previous solution.

    Saturday, October 8, 2011 6:52 PM
  •   WP:

             Assign  two properties  in main form  for every page and change these

           two values when activating or decativating  in event handler of activate or    deactivate   

            TAHISFROM.aprop1=1

          THISFORM.dprop1=1

       CALL A METHOD  IN mainform  to execute   part of code depending on  properties

      values of  each  activepage  .

    after executing the code part you can reset  the values to 0  as example or

    what ever you  see .This  SUPPOSE TO HELP

     For me i prefer to  write the code of every page  in its  event handlers

     


    azizsallam
    Saturday, October 8, 2011 7:49 PM
  • Hi WP,

    as an alternative you could make use of BINDEVENTS(). Just bind each pages Activate event to a central pagehandler that holds your code that shall be executed.

    Just expand the code below to the number of pages within your pageframe.

    BINDEVENT( Thisform.Pageframe1.Page1 , [Activate] , Thisform , [PageHandler] , 0 )
    BINDEVENT( Thisform.Pageframe1.Page2 , [Activate] , Thisform , [PageHandler] , 0 )
    
    

    Now, add a method called i.e. 'Pagehandler' to your form and put your code in that method.


    Gruss / Best regards -Tom 010101100100011001010000011110000101001001101111011000110110101101110011
    • Proposed as answer by Naomi N Sunday, October 9, 2011 5:02 AM
    • Marked as answer by Kee Poppy Friday, October 14, 2011 8:40 AM
    Saturday, October 8, 2011 9:48 PM
    Answerer