FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Adding and Deleting tabs on Dlg at runtime
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Adding and Deleting tabs on Dlg at runtime
Posted: Tue Feb 21, 2012 04: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.

Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Adding and Deleting tabs on Dlg at runtime
Posted: Wed Feb 22, 2012 12:36 AM
Hello

yes, review sample testfldd.prg

it's a mod form testfldd.prg

Code (fw): Select all Collapse
// 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

Continue the discussion