Page 1 of 1

How to close FoldeEx Tab ?

Posted: Mon Aug 25, 2014 5:02 am
by shahir.fivewin
Dear All,
Could you please give me code to close FolderEx Tab ? And one more how do check if FolderEx Tab Exist in same name ?

Thanking You
Muhammed Shahir

Re: How to close FoldeEx Tab ?

Posted: Mon Aug 25, 2014 12:05 pm
by ukoenig
Muhammed,

Testing for DOUBLE-prompts

Image

You can HIDE or DISABLE a tab ( POPUP on Tab-mouseclick ).
Tab-delete You can test, using button < Delete tab &3 >

Code: Select all

#include "FiveWin.ch"

// Could you please give me code to close FolderEx Tab ? 
// And one more how do check if FolderEx Tab Exist in same name ?

FUNCTION MAIN()
local oWnd, i
local oFld
local aBitmaps := { ".\bitmaps\alphabmp\exit.bmp",;
                ".\bitmaps\\exit.bmp",;
                ".\bitmaps\\exit.bmp",;
                ".\bitmaps\\exit.bmp",;
                ".\bitmaps\\exit.bmp",;
                ".\bitmaps\\exit.bmp" }
 
DEFINE FONT oFont NAME 'Arial' SIZE  6,15

DEFINE WINDOW oWnd TITLE "TFolderex - Testing -" FROM 50, 50 TO 400, 570 PIXEL
   
@ 15, 20 FOLDEREX oFld SIZE 450, 200 OF oWnd PIXEL ROUND 5 UPDATE ;     
     PROMPT  "Option 1", "Option 2", "Option 3", "Option 2", "Option 2";//          
     BITMAPS aBitmaps;
     ACTION( ::HideTab( nOption ) );
    TOP ALIGN FLDBMP_RIGHT, FLDBMP_RIGHT, FLDBMP_RIGHT, FLDBMP_RIGHT, ;
     FLDBMP_RIGHT, FLDBMP_RIGHT ;
     POPUP MenuTabs( Self, nOption ) FONT oFont
   
FOR i = 1 TO Len( oFld:aPrompts )
      oFld:SetBrightBmp( ".\bitmaps\exit2.bmp", i )          
NEXT
  
@ 250, 30 BUTTON "&Check Items" SIZE 100, 30 FONT oFont OF oWnd PIXEL ;
ACTION TEST_ITEMS(oFld)

@ 250, 140 BUTTON "Delete tab &3" SIZE 100, 30 FONT oFont OF oWnd PIXEL ;
ACTION oFld:DelItem( 3 )

@ 250, 255 BUTTON "Show &all" SIZE 100, 30 FONT oFont OF oWnd PIXEL ;
ACTION SHOW_ALL( oFld )

@ 250, 380 BUTTON "&Exit" SIZE 80, 30 FONT oFont OF oWnd PIXEL ;
ACTION oWnd:End()

ACTIVATE WINDOW oWnd

oFont:End()
   
RETURN NIL

// ---------

FUNCTION SHOW_ALL(oFld)
LOCAL X := 1

FOR X := 1 TO LEN( oFld:aPrompts )
    oFld:ShowTab( X )
NEXT

RETURN NIL

// ---------

FUNCTION TEST_ITEMS(oFld)
LOCAL X := 1, Y := 1, lEnd := .F., cDouble := ""

FOR X := 1 TO LEN( oFld:aPrompts )
    cPrompt := oFld:aPrompts[X]
    Y := 1
    FOR Y := 1 TO LEN( oFld:aPrompts )
        IF oFld:aPrompts[Y] = cPrompt .and. Y <> X
            cDouble := cDouble + ALLTRIM(STR(Y)) + " / "
            lEnd := .T.
        ENDIF
    NEXT
    cDouble := SUBSTR( cDouble, 1, LEN( cDouble ) - 3 )
    IF lEnd = .T.
        MsgAlert( "Double prompt in TAB : " + ;
                       ALLTRIM(STR(X)) + " / " + cDouble, "Double prompts" )
        EXIT
    ENDIF
NEXT

RETURN NIL

// ---------

FUNCTION MENUTABS( oFld, nOpt )
LOCAL oMenu
   
MENU oMenu POPUP 2007
      MENUITEM oFld:aPrompts[ nOpt ]
      SEPARATOR
      MenuAddItem( "Show", , ;
                    oFld:aVisible[ nOpt ], ,;
                    {|| If( oFld:aVisible[ nOpt ], ;
                            oFld:HideTab( nOpt ), ;
                            oFld:ShowTab( nOpt ) ) } ) 
      MenuAddItem( "Enabled", , ;
                    oFld:aEnable[ nOpt ], ,;
                    {|| If( oFld:aEnable[ nOpt ], ;
                            oFld:DisableTab( nOpt ), ;
                            oFld:EnableTab( nOpt ) ) } ) 
ENDMENU
   
RETURN oMenu
 
best regards
Uwe :?:

Re: How to close FoldeEx Tab ?

Posted: Tue Aug 26, 2014 3:58 am
by shahir.fivewin
Thank You very much.