Extension to TFolderEx

Extension to TFolderEx

Postby byte-one » Mon Oct 17, 2011 9:55 am

I made a extension for Tfolderex-class. (Antonio: adding to next build?)

Now we can colouring all dialogs with different colors (CLR_WHITE,CLR_GREEN,...) or gradient-brushes in the format {{},{},...},... or file-brushes (test1.bmp,test2.jpg,...) . If only one is defined, all the dialogs are with same color or brush.

1. New method SetDiaColors to coloring the dialogs from folder

Code: Select all  Expand view
METHOD SetDiaColors( oDlg , n ) CLASS TFolderEx

local oBrush

    if Len( ::aClrDialogs ) >= n .and. (valtype(::aClrDialogs[n]) == "N" .or. valtype(::aClrDialogs[n]) == "A" .or. (valtype(::aClrDialogs[n]) == "C" .and. file(rtrim(::aClrDialogs[n])) ) )
        if valtype(::aClrDialogs[n]) == "N"
            oBrush = TBrush():New( , ::aClrDialogs[ n ] )   //simple color
        elseif valtype(::aClrDialogs[n]) == "A"
            oBrush := TBrush():New(,,,,::aClrDialogs[n])    //array with gradient
        else
            oBrush := TBrush():New( , ,rtrim(::aClrDialogs[ n ]) )  //picture-file
        endif
            oDlg:SetBrush( oBrush )
    else
        if oDlg:lTransparent
            if ::oWnd:oBrush != NIL
                oDlg:SetBrush( ::oWnd:oBrush )
            else
                oBrush = TBrush():New( , ::oWnd:nClrPane )
                oDlg:SetBrush( oBrush )
            endif
        else
            oBrush = TBrush():New( , CLR_WHITE )
            oDlg:SetBrush( oBrush )
        endif

    endif
    if hb_isObject( oBrush )
        oBrush:end()
    endif

RETURN NIL


2. In method Default()

Code: Select all  Expand view
    ::SetDiaColors( oDlg , nAkt )  //NEW!

      ACTIVATE DIALOG oDlg NOWAIT VALID .f.;
              ON INIT ::Move( aMove[ 1 ], aMove[ 2 ] )


3. New Header

Code: Select all  Expand view
#xcommand @ <nRow>, <nCol> FOLDEREX [<oFolder>] ;
             [ <of: OF, WINDOW, DIALOG> <oWnd> ] ;
             [ <prm: PROMPT, PROMPTS, ITEMS> <cPrompt,...> ] ;
             [ <bm: BITMAPS, IMAGES, BMPS> <cbmps,...> ] ;
             [ <lPixel: PIXEL> ] ;
             [ <lDesign: DESIGN> ] ;
             [ TAB HEIGHT <ntabheight> ];
             [ SEPARATOR <nSep> ];
             [ OPTION <nOption> ] ;
             [ ROUND <nRound> ];
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <lAdjust: ADJUST> ] ;
             [ <lStretch: STRETCH> ] ;
             [ POPUP <upop>];
             [ ALIGN <nAlign,...> ] ;
             [ ACTION <uAction> ];
             [ BRIGHT <nBright> ] ;
             [ ON CHANGE <uChange> ] ;
             [ ON PAINT TAB <uPaint> ];
             [ ON PAINT TEXT <uPaintxt> ];
             [ HELPTOPICS <cnHelpids,...> ] ;
             [ <layout: TOP, LEFT, BOTTOM, RIGHT> ] ;
             [ <lAnimate: ANIMATE> [ SPEED <nSpeed> ] ] ;
         [ FONT <oFont> ] ; //-->> byte-one 2010
             [ <lTransparent: TRANSPARENT> ] ;
         [ DIALOGCOLORS <nColors,...> ] ; //-->> byte-one 2011
       => ;
             [<oFolder> := ] TFoldereX():New( <nRow>, <nCol>, <nWidth>, <nHeight>,;
             <oWnd>, [\{<cbmps>\}], <.lPixel.>, <.lDesign.>, [\{<cPrompt>\}], ;
             <ntabheight>, [\{<cnHelpids>\}], <nRound>, [{|nOption, nOldOption, Self | <uChange>}],;
             [{|Self,nOption| <uPaint>}], [{|Self,nOption| <uPaintxt>}], ;
             [\{<nAlign>\}], <.lAdjust.>, <nSep>, <nOption>, [{|Self,nOption| <upop>}],;
             <.lStretch.>, [ Upper(<(layout)>) ], [{|Self,nOption| <uAction>}], <nBright>, <.lAnimate.>, [<nSpeed>],;
             <oFont>,<.lTransparent.>,[\{<nColors>\}])

#xcommand REDEFINE FOLDEREX [<oFolder>];
             [ ID <nId> ] ;
             [ <of: OF, WINDOW, DIALOG> <oWnd> ] ;
             [ <prm: PROMPT, PROMPTS, ITEMS> <cPrompt,...> ] ;
             [ <bm: BITMAPS, IMAGES, BMPS> <cbmps,...> ] ;
             [ <dlg: DIALOG, DIALOGS, PAGE, PAGES> <cDlgsName,...> ] ;
             [ TAB HEIGHT <ntabheight> ];
             [ OPTION <nOption> ] ;
             [ ROUND <nRound> ];
             [ SEPARATOR <nSep> ];
             [ <lAdjust: ADJUST> ] ;
             [ <lStretch: STRETCH> ] ;
             [ POPUP <upop>];
             [ ALIGN <nAlign,...> ] ;
             [ BRIGHT <nBright> ] ;
             [ ACTION <uAction> ];
             [ ON CHANGE <uChange> ] ;
             [ ON PAINT TAB <uPaint> ];
             [ ON PAINT TEXT <uPaintxt> ];
             [ HELPTOPICS <cnHelpids,...> ] ;
             [ <layout: TOP, LEFT, BOTTOM, RIGHT> ] ;
             [ <lAnimate: ANIMATE> [ SPEED <nSpeed> ] ] ;
         [ FONT <oFont> ]; //-->> byte-one 2010
             [ <lTransparent: TRANSPARENT> ] ;
         [ DIALOGCOLORS <nColors,...> ] ; //-->> byte-one 2011
        => ;
             [<oFolder> := ] TFoldereX():ReDefine( <nId>, <oWnd>, [\{<cDlgsName>\}],;
             [\{<cbmps>\}], [\{<cPrompt>\}], <ntabheight>, [\{<cnHelpids>\}],;
             <nRound>, [{|nOption,nOldOption,Self| <uChange>}],;
             [{|Self,nOption| <uPaint>}], [{|Self,nOption| <uPaintxt>}], ;
             [\{<nAlign>\}], <.lAdjust.>, <nSep>, <nOption>, ;
             [{|Self,nOption| <upop>}], <.lStretch.>, [ Upper(<(layout)>) ],;
             [{|Self,nOption| <uAction>}], <nBright>, <.lAnimate.>, [<nSpeed>],;
             <oFont>,<.lTransparent.>,[\{<nColors>\}] )
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: Extension to TFolderEx

Postby ukoenig » Mon Oct 17, 2011 2:38 pm

Günther,

I added the changes, but still something missing

::SetDiaColors( oDlg , nAkt ) //NEW!

as well I think, we have to define JPG - Brushes stretched ( Image Background )

------------ this works with guaranteed transparent painting of controls -------------

Brush ( BMP ) :

Image

DEFINE BRUSH oBrush FILENAME cBrush
oDlg:SetBrush( oBrush )

---------------------------------------------

Image ( JPG ) :

Image

LOCAL PixelX := MulDiv( oControl:nWidth(), nLoWord( GetDlgBaseUnits() ), 4 )
LOCAL PixelY := MulDiv( oControl:nHeight(), nHiWord( GetDlgBaseUnits() ), 8 )
...
...
DEFINE IMAGE oImage FILE cImage
// Tabheight-adjustment needed !
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, PixelX, PixelY - 30, .T. ) ) oImage:End()
SET BRUSH OF oDlg TO oBrush

-------------------------------------------------

Gradient ( vertical ) :

Image

hBmp = CreateCompatibleBitMap( oDlg:hDC, PixelX, PixelY )
hBmpOld = SelectObject( hDC, hBmp )
// - 30 => - Tabheight-adjustment needed !!!
GradientFill( hDC, 0, 0, PixelY - 30, PixelX, aGrad, lDirect )
DeleteObject( oDlg:oBrush:hBrush )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
oDlg:SetBrush( oBrush )

----------------------------------------------

There is a Problem with DIALOG NOWAIT
I only got it working, calling a Function :

Code: Select all  Expand view

IF nStyleD = 1 // Color
    F_BACKGRD( oFld1, nStyleD, , nVColorD )
ENDIF
IF nStyleD = 2 // Gradient
    F_BACKGRD( oFld1, nStyleD, lDirectD, nVColorD, nBColorD, nMoveD )
ENDIF
IF nStyleD = 3 // Brush
    F_BACKGRD( oFld1, nStyleD, , , , , cBrushD )
ENDIF
IF nStyleD = 5 // Image
    F_BACKGRD( oFld1, nStyleD, , , , , , cImageD )
ENDIF
IF nStyleD = 6 // Styles
    F_BACKGRD1( oFld1, nPStyleD )
ENDIF

ACTIVATE DIALOG oDlgMain1 NOWAIT ;
ON INIT oDlgMain1:Move( 220 , 180, 810, 480, .f. )

RETURN( NIL )
 


Best Regards
Uwe :?:
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft and 73 guests