FolderEx Disable Top color stripe

FolderEx Disable Top color stripe

Postby Rick Lipkin » Fri Mar 16, 2012 10:03 pm

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 view

oFld:DisableTab( 2 )
 


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

Rick Lipkin

Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FolderEx Disable Top color stripe

Postby ukoenig » Fri Mar 16, 2012 10:59 pm

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 view

@ 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:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: FolderEx Disable Top color stripe

Postby Otto » Sat Mar 17, 2012 12:19 am

Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: FolderEx Disable Top color stripe

Postby Rick Lipkin » Sat Mar 17, 2012 2:45 pm

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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FolderEx Disable Top color stripe

Postby Francisco Horta » Sat Mar 17, 2012 5:34 pm

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
____________________
Paco
Francisco Horta
 
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Re: FolderEx Disable Top color stripe

Postby Rick Lipkin » Sat Mar 17, 2012 5:47 pm

Paco

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

Thank You
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests