Page 1 of 1

FolderEx Disable Top color stripe

Posted: Fri Mar 16, 2012 10:03 pm
by Rick Lipkin
To All

Is there a way to grey out the Orange stripe on a disabled folder tab .. using this basic method does disable the second tab but it leaves a orange stripe on the top of the tab ?

Code: Select all | Expand


oFld:DisableTab( 2 )
 


Is there any way of greying out the orange stripe on the disabled folder tab ?

Rick Lipkin

Image

Re: FolderEx Disable Top color stripe

Posted: Fri Mar 16, 2012 10:59 pm
by ukoenig
Rick,

You can define a Tab-brush ( I used Stone.bmp )
To show Page and Tab with the same Brush, You have to define a extra Brush for the Page ( same BMP ).

Image

Code: Select all | Expand


@ 20, 145 FOLDEREX SIZE 178, 110 oFld1 PIXEL ROUND 5 ; // Top, Left, Width, Height
PROMPT  "&Color", "&Grad.", "&Brush", "&Img." OF oDlg1 ;
BITMAPS "Page", "Page", "Page", "Page" ;
ON PAINT TAB PaintTab( Self, nOption )

oFld1:lTransparent := .T.
oFld1:nFolderHeight := 30
oFld1:nSeparator := 3
oFld1:nRound := 5
oFld1:bClrText := {| o, n | 128 } // red Tab-text
oFld1:oFont := oFont // Tab-font

oFld1:DisableTab( 2 )

F_PAGE1( oFld1 )
F_PAGE2( oFld1 )
F_PAGE3( oFld1 )
F_PAGE4( oFld1 )

F_BACKGRD( oFld1, lDDirect, nDColorF, nDColorB, nDGradPos, cDBrush, cDImage )  

...
...

FUNCTION PaintTab( o, nOption )
LOCAL hBrush, hBmp, nLastRow

IF nOption == 2 // disabled !!!
      hBmp = ReadBitmap( 0, c_path + "\Images\stone.bmp" )
      hBrush = CreatePatternBrush( hBmp )
      DeleteObject( hBmp )
      nLastRow = o:aPos[ o:aLines[ o:aOrder[ 1 ] ][ 1 ] ][ 2 ] + o:nFolderHeight
      SetBrushOrgEx( o:hDC, 1, nLastRow + 2 )
      RETURN hBrush
ENDIF

IF nOption == o:nOption .and. nOption == 3 // Brush of a selected Tab
      hBmp = ReadBitmap( 0, c_path + "\Images\marble.bmp" )
      hBrush = CreatePatternBrush( hBmp )
      DeleteObject( hBmp )
      nLastRow = o:aPos[ o:aLines[ o:aOrder[ 1 ] ][ 1 ] ][ 2 ] + o:nFolderHeight
      SetBrushOrgEx( o:hDC, 1, nLastRow + 2 )
      RETURN hBrush
ENDIF  

RETURN o:SetFldColors( o, nOption )      

// --------  FOLDER - Backgrounds ---------------

FUNCTION F_BACKGRD( oFld, lDirect, nColor1, nColor2, nMove, cBrush, cImage )
LOCAL n, oDlg, hDC, oBrush, oImage, nRow := 0, nCol := 0, lFound := .T.
LOCAL aGrad1 := { { nMove, nColor1, nColor1 }, { nMove, nColor1, nColor1 } }
LOCAL aGrad2 := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
//LOCAL PixelX := MulDiv(oFld:nWidth(), nLoWord( GetDlgBaseUnits() ), 4)
//LOCAL PixelY := MulDiv(oFld:nHeight(), nHiWord( GetDlgBaseUnits() ), 8)
PixelX := 0.3
PixelY := 0.3

// shows a different Brush on each Page !!!
// ------------------------------------------------
    FOR n := 1 to Len( oFld:aDialogs )
        oDlg := oFld:aDialogs[ n ]
        hDC = CreateCompatibleDC( oDlg:GetDC() )

        IF n = 1 // Color
            hBmp = CreateCompatibleBitMap( oDlg:hDC, 380, 236 ) // Width, Height
            hBmpOld = SelectObject( hDC, hBmp )
            //  Adjustment - 30 => - Tabheight needed / - 3 = Bottom Tab = Top Gradient !!!
            GradientFill( hDC, - 3, 0, 236 - 30, 380, aGrad1, lDirect ) // Height, Width
            DeleteObject( oDlg:oBrush:hBrush )
            oBrush := TBrush():New( ,,,, hBmp )
            oBrush:Cargo  := aGrad1
            SelectObject( hDC, hBmpOld )
            oDlg:SetBrush( oBrush )
        ENDIF
        IF n = 2 // Gradient
            hBmp = CreateCompatibleBitMap( oDlg:hDC, 380, 236 ) // Width, Height
            hBmpOld = SelectObject( hDC, hBmp )
            //  Adjustment - 30 => - Tabheight needed / - 3 = Bottom Tab = Top Gradient !!!
            GradientFill( hDC, - 3, 0, 236 - 30, 380, aGrad2, lDirect ) // Height, Width
            DeleteObject( oDlg:oBrush:hBrush )
            oBrush := TBrush():New( ,,,, hBmp )
            oBrush:Cargo  := aGrad2
            SelectObject( hDC, hBmpOld )
            oDlg:SetBrush( oBrush )
        ENDIF
        IF n = 3 // Brush
            IF !FILE( c_path + "\Images\" + cBrush )
                MsgAlert( "
File : " + c_path + "\Images\" + cBrush + CRLF + ;
                        "
does not exist to create" + CRLF + ;
                        "
Brush-Background !", "ATTENTION" )
                lFound := .F.
            ELSE
                DEFINE BRUSH oBrush FILENAME c_path + "
\Images\" + cBrush
                oDlg:SetBrush( oBrush )
            ENDIF
        ENDIF
        IF n = 4 //
            IF !FILE( c_path + "
\Images\" + cImage )
                MsgAlert( "
File : " + c_path + "\Images\" + cBrush + CRLF + ;
                        "
does not exist to create" + CRLF + ;
                        "
Image-Background !", "ATTENTION" )
                lFound := .F.
            ELSE
                DEFINE IMAGE oImage FILE c_path + "
\Images\" + cImage
                oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, 364, 220, .T. ) )  // Width, Height
                oImage:End()
                SET BRUSH OF oDlg TO oBrush
            ENDIF
        ENDIF
        RELEASE BRUSH oBrush
        ReleaseDC(hDC)
    NEXT

RETURN( NIL )
 


Best Regards
Uwe :lol:

Re: FolderEx Disable Top color stripe

Posted: Sat Mar 17, 2012 12:19 am
by Otto
Best regards,
Otto

Image

Re: FolderEx Disable Top color stripe

Posted: Sat Mar 17, 2012 2:45 pm
by Rick Lipkin
Uwe

In my situation I do want to disable the second tab ON PAINT, but I want to re-enable the tab back to its defaults when some data is entered into the first folder. Is there a way to trap the oFld:Enable(2) and destroy the bitmap brush used to 'mask' the disabled tab?

Also, is there an alternate way to load the brush bitmap from resources rather than ReadBitMap()

Thanks
Rick Lipkin

Re: FolderEx Disable Top color stripe

Posted: Sat Mar 17, 2012 5:34 pm
by Francisco Horta
Rick
try using a gradient color
aColorDis := { { 1, nRGB( 190, 190, 190), nRGB( 211, 211, 211 ) } }
oFld:aGradDis := aColorDis
this my ex..
Image

regards
paco

Re: FolderEx Disable Top color stripe

Posted: Sat Mar 17, 2012 5:47 pm
by Rick Lipkin
Paco

That worked PERFECT .. and oFld:EnableTab( 2 ) brought back the standard colors !!

Thank You
Rick Lipkin