Adding and Deleting tabs on Dlg at runtime

Adding and Deleting tabs on Dlg at runtime

Postby reinaldocrespo » Tue Feb 21, 2012 4:15 pm

Hi everyone;

I wish to add tabs to a FW folder control at runtime. Likewise, I'd like to add an x btnbmp at the right of the tab to allow closing the tab page. The tab control is on a dialog control. In short, it would look like browser tabs that you can keep creating or deleting at any time. Is this possible? Any samples?

Thank you for any help,



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Adding and Deleting tabs on Dlg at runtime

Postby Daniel Garcia-Gil » Wed Feb 22, 2012 12:36 am

Hello

yes, review sample testfldd.prg

it's a mod form testfldd.prg

Code: Select all  Expand view

// Dinamically adding pages and controls

#include "FiveWin.ch"

function Main()

   local oDlg, oFld

   DEFINE DIALOG oDlg RESOURCE "test"

   REDEFINE FOLDER oFld ID 110 OF oDlg ;
      DIALOGS "dlg1", "dlg2" PROMPTS "One", "Two"

   REDEFINE BUTTON ID 120 OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT AddDialog( oFld )

return nil

function AddDialog( oFld )
   
   local nOpt

   oFld:AddItem( "third" )
   
   @ 2, 2 BUTTON "Add from res" OF oFld:aDialogs[ 3 ] SIZE 80, 20 ;
      ACTION ( oFld:AddItem( "Fourth", "dlg2", { | oDlg | RedefineControls( oDlg ) } ),;
               ATail( oFld:aDialogs ):SetFont( oFld:oFont ) )

   @ 4, 2 BUTTON "Del Last Tab" OF oFld:aDialogs[ 3 ] SIZE 80, 20 ;
      ACTION ( nOpt := oFld:nOption, oFld:nOption := Len( oFld:aPrompts ), oFld:DelItem(), oFld:SetOption( nOpt ) )

return nil

function RedefineControls( oDlg )

   local nValue := 1

   REDEFINE RADIO nValue ID 110, 120 OF oDlg ON CHANGE MsgBeep()
   
return nil  
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 92 guests