Page 1 of 1

More modern looking folders

Posted: Thu Apr 23, 2009 12:47 am
by Jeff Barnes
Hi,

I am just starting a new app and I would like to have a more modern looking folder.
Something to give a catchy look.

Does anyone have any ideas?

Currently I am creating them this way:

Code: Select all | Expand

  Define Dialog oDlg RESOURCE "MyDialog"
      redefine folder oFld ID 101 of oDlg ;
       PROMPT "One","Two","Three" ;
       DIALOGS "DlgOne","DlgTwo","DlgThree"

      //DlgOne
      redefine get oGet var Config->Name       id 100 of oFld:aDialogs[1]
      redefine get oGet var Config->Address    id 101 of oFld:aDialogs[1]
     
     //DlgTwo
      redefine get oGet var Config->SomeVar       id 100 of oFld:aDialogs[2]
       
     //DlgThree
     redefine get oGet var Config->SomeVar2       id 100 of oFld:aDialogs[3]

   ACTIVATE DIALOG oDlg CENTERED

Re: More modern looking folders

Posted: Thu Apr 23, 2009 9:04 am
by ukoenig
Hello Jeff,

some basics : Folder-Gradient, Images on Folder-Tabs and more

Code: Select all | Expand


FUNCTION MAIN()
Local oDlg, oFld

nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, ;
WS_SYSMENU,WS_MINIMIZEBOX, WS_MAXIMIZEBOX )
oFont := TFont():New("Arial", ,-14,.F.,.F. , , , ,.F. )

DEFINE DIALOG oDlg RESOURCE "MyDialog" STYLE nSTYLE TRANSPARENT ;
TITLE  "My Title" FONT oFont

Redefine folder oFld ID 101 of oDlg ;
PROMPT "One","Two","Three" ;
DIALOGS "DlgOne","DlgTwo","DlgThree" ;
ON CHANGE( SetCondition( oWnd, oFld, nOption, nOldOption ) )

// Extern Function for each Page ( a Solution to manage many Pages )
// Don't keep them all in the Main-Function
// ------------------------------------------------

PAGE_1(oDlg,oFld)  
PAGE_2(oDlg,oFld)
PAGE_3(oDlg,oFld)  

// Move the Dialog to the Position You need
// Set images on Folder-Tabs
// Paint Gradient on Dialog and Folder
// ---------------------------------------------       
ACTIVATE DIALOG oDlg CENTERED
ON INIT ( oDlg:Move( 30 , 10, oDlg:nWidth, oDlg:nHeight, .f. ), ;
            SetImages( oDlg, oFld ) ) ;
ON PAINT ( SetDlgGrad( hDC, oDlg ), SetFoldGrad( oFld )  )

RETURN( NIL )

// --------- DIALOG-GRADIENT --------------------------------------

STATIC FUNCTION SetDlgGrad( hDC, oDlg )

local aGrad := { { 0.50, 16054371, 11892819 } }

GradientFill( hDC,  0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .F. )

RETURN NIL

// ---------- FOLDER GRADIENT --------------------------------------

STATIC FUNCTION SetFoldGrad( oFld )

local n, oDlg
   
for n = 1 to Len( oFld:aDialogs )
      oDlg = oFld:aDialogs[ n ]      
      oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, ;
      { { 0.50, 12609872, 16045947 } } ) }
next    

RETURN NIL    

//--------- SET ANY CONDITIONS, BEFORE THE PAGE-SELECTION ------------

STATIC FUNCTION SetCondition( oWnd, oFld, nOption, nOldOption )

IF nOption == 1
    // Define something, before Page-Select
ENDIF    
IF nOption == 2
    // Define something, before Page-Select
ENDIF
IF nOption == 3
    // Define something, before Page-Select
ENDIF

RETURN .T.

//---------------- PAGE IMAGES ---------------------------------------

FUNCTION SetImages( oDlg, oFld )
local oImageList
   
DEFINE IMAGELIST oImageList SIZE 16, 16
   
oImageList:AddMasked( TBitmap():Define( "image1",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "open1",,     oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "colors1",,   oDlg ), nRGB( 192, 192, 192 ) )    

oFld:SetImageList( oImageList )
   
return nil  

// ------------- PAGE 1 -----------------------------

FUNCTION PAGE_1(oDlg,oFld)  
LOCAL oGet1

redefine get oGet1 var Config->Name       id 100 of oFld:aDialogs[1]
redefine get oGet1 var Config->Address    id 101 of oFld:aDialogs[1]

RETURN ( NIL )

// -------------- PAGE 2 ----------------------------

FUNCTION PAGE_2(oDlg,oFld)  
LOCAL oGet2

redefine get oGet2 var Config->SomeVar       id 100 of oFld:aDialogs[2]

RETURN ( NIL )

// --------------- PAGE 3 ---------------------------

FUNCTION PAGE_3(oDlg,oFld)  
LOCAL oGet3

redefine get oGet3 var Config->SomeVar2       id 100 of oFld:aDialogs[3]

RETURN ( NIL )
 


Regards
Uwe :lol:

Re: More modern looking folders

Posted: Fri Apr 24, 2009 12:28 am
by Jeff Barnes
Hi Ukoenig,

I get an error in compile ... it can't find GradientFill()

Where is this function located?

Re: More modern looking folders

Posted: Fri Apr 24, 2009 1:43 am
by hua
Jeff,

>>I get an error in compile ... it can't find GradientFill()
>>Where is this function located?
It should be in FWH 8.07
* New: function GradientFill( hDC, nTop, nLeft, nBottom, nRight, aGradient ) where aGradient can contain any number
of gradients and should be specified the following way:
{ { nPart, nClrStart, nClrEnd }, { nPart, nClrStart, nClrEnd }, ... }
nPart is to be specified as 0.25, 0.5, etc. and should agregate to 1.

This function is used from Class TXBrowse, Class TBar and Class TBtnBmp. Please review samples\TestGrad.prg

Re: More modern looking folders

Posted: Fri Apr 24, 2009 2:30 am
by Jeff Barnes
Thanks Hua,

Recently rebuild my system ... I had installed 7.11 :oops:

Now it compiles but looks the same as before ... I must be missing something.

Re: More modern looking folders

Posted: Fri Apr 24, 2009 7:53 am
by HunterEC
Ukoening:

Thank you for your collaboration. I'm getting the following compile errors:
    Folders.prg(5) Warning W0001 Ambiguous reference: 'DS_MODALFRAME'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'WS_POPUP'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'WS_CAPTION'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'WS_SYSMENU'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'WS_MINIMIZEBOX'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'WS_MAXIMIZEBOX'
    Folders.prg(5) Warning W0001 Ambiguous reference: 'NSTYLE'
    Folders.prg(6) Warning W0001 Ambiguous reference: 'OFONT'
    Folders.prg(9) Error E0030 Syntax error: "syntax error at 'DIALOG'"
    Folders.prg(14) Error E0030 Syntax error: "syntax error at 'FOLDER'"
    Folders.prg(28) Error E0030 Syntax error: "syntax error at 'DIALOG'"
    Folders.prg(31) Error E0030 Syntax error: "syntax error at 'INIT'"
    Folders.prg(80) Error E0030 Syntax error: "syntax error at 'IMAGELIST'"
    Folders.prg(95) Error E0030 Syntax error: "syntax error at 'GET'"
    Folders.prg(96) Error E0030 Syntax error: "syntax error at 'GET'"
    Folders.prg(105) Error E0030 Syntax error: "syntax error at 'GET'"
    Folders.prg(114) Error E0030 Syntax error: "syntax error at 'GET'"

Re: More modern looking folders

Posted: Fri Apr 24, 2009 8:52 am
by ukoenig
Hello Jeff,

with Your FWH-Version 7.11, Bitmap-support is included.
some functions are new, up from defined FWH-Releases.
For Gradient-Painting, You can try ( replace Gradientfill ) the function on Bottom.
For COLOR1 and COLOR2 use Your Color-values.
The Gradient-Function works for Folders as well.
Change Function Gradientfill with => Degrade ( hDC, oDlg )


October 2007 build ( FWH 7.10 )
===========================
* New: Class TFolder bitmaps support.
Please review samples\TestFold.prg


July 2008 build ( FWH 8.07 )
========================
* Enhancement: function GradientFill() now allows to specify horizontal or vertical painting.
Please review samples\TestGrd2.prg

* New: Class TDialog TRANSPARENT clause admits the use of bitmaps (not as brushes). Please review
samples\TestTrn2.prg

Code: Select all | Expand


STATIC FUNCTION Degrade ( hDC, oWnd )

LOCAL nStep , nStepY
LOCAL oBrush
LOCAL i, r,g,b
LOCAL r0,g0,b0
LOCAL r1, g1, b1
LOCAL rD, gD, bD
LOCAL aRect := GETCLIENTRECT( oWnd:hWnd )

nStep  := ( aRect[ 3 ] - aRect[ 1 ] )
nStepY := ( aRect[ 3 ] - aRect[ 1 ] ) / nStep
aRect[ 3 ] = aRect[ 1 ] + nStepY

r0 := nRGBRed (COLOR1)
g0 := nRGBGreen (COLOR1)
b0 := nRGBBlue (COLOR1)
r1 := nRGBRed (COLOR2)
g1 := nRGBGreen (COLOR2)
b1 := nRGBBlue (COLOR2)
rD := r1-r0
gD := g1-g0
bD := b1-b0

r := 256*rD/Max(nStep,1)
g := 256*gD/Max(nStep,1)
b := 256*bD/Max(nStep,1)

r0*=256
g0*=256
b0*=256

FOR i = 0 TO nStep-1 STEP nStepY
    r0 += r
    g0 += g
    b0 += b
    DEFINE BRUSH oBrush COLOR nRGB( r0/256, g0/256, b0/256 )
    FILLRECT( hDC, aRect, oBrush:hBrush )
    RELEASE BRUSH oBrush

    aRect[ 1 ] += nStepY
    aRect[ 3 ] += nStepY
NEXT

RETURN (nil)
 


Regards
Uwe :lol:

Re: More modern looking folders

Posted: Fri Apr 24, 2009 11:53 am
by Otto
Hello Uwe,
could you please post a screen.
Thanks in advance
Otto

Re: More modern looking folders

Posted: Fri Apr 24, 2009 10:18 pm
by ukoenig
Hello Otto,

here is the screenshot and some small source-changes.
I think, it will work without problems with FWH-Version 7.11

Image

Code: Select all | Expand


#include "FiveWin.ch"
#include "Folder.ch"

static oWnd, oDlg, oFld, hDC

FUNCTION MAIN()

oFont := TFont():New("Arial", ,-14,.F.,.F. , , , ,.F. )

SetBalloon( .T. ) // Balloon shape required for tooltips

DEFINE WINDOW oWnd TITLE "Foldertest"  MDI  MENU TMenu():New()  


SET MESSAGE OF oWnd TO "Folder-Test" ;
CENTERED CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT TEST(oWnd) ;
ON PAINT Degrade ( hDC, oWnd, 8388608, 16777215 )

RETURN NIL

// ----------------- WINDOW and DIALOG GRADIENT -------------------

STATIC FUNCTION Degrade ( hDC, oWnd, nCOLOR1, nCOLOR2 )

LOCAL nStep , nStepY
LOCAL oBrush
LOCAL i, r,g,b
LOCAL r0,g0,b0
LOCAL r1, g1, b1
LOCAL rD, gD, bD
LOCAL aRect := GETCLIENTRECT( oWnd:hWnd )

nStep  := ( aRect[ 3 ] - aRect[ 1 ] )
nStepY := ( aRect[ 3 ] - aRect[ 1 ] ) / nStep
aRect[ 3 ] = aRect[ 1 ] + nStepY

r0 := nRGBRed (nCOLOR1)
g0 := nRGBGreen (nCOLOR1)
b0 := nRGBBlue (nCOLOR1)
r1 := nRGBRed (nCOLOR2)
g1 := nRGBGreen (nCOLOR2)
b1 := nRGBBlue (nCOLOR2)
rD := r1-r0
gD := g1-g0
bD := b1-b0

r := 256*rD/Max(nStep,1)
g := 256*gD/Max(nStep,1)
b := 256*bD/Max(nStep,1)

r0*=256
g0*=256
b0*=256

FOR i = 0 TO nStep-1 STEP nStepY
    r0 += r
    g0 += g
    b0 += b
    DEFINE BRUSH oBrush COLOR nRGB( r0/256, g0/256, b0/256 )
    FILLRECT( hDC, aRect, oBrush:hBrush )
    RELEASE BRUSH oBrush

    aRect[ 1 ] += nStepY
    aRect[ 3 ] += nStepY
NEXT

RETURN (nil)

// ---------- FOLDER GRADIENT --------------------------------------

STATIC FUNCTION SetFoldGrad( oFld, nCOLOR1, nCOLOR2 )

local n, oDlg
   
for n = 1 to Len( oFld:aDialogs )
      oDlg = oFld:aDialogs[ n ]      
      oDlg:bPainted = { | hDC | Degrade ( hDC, oDlg, nCOLOR1, nCOLOR2 ) }
next    

RETURN NIL    

//-----------------  TEST ---------------------------------------------

FUNCTION Test(oWnd)

nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU,WS_MINIMIZEBOX, WS_MAXIMIZEBOX )

DEFINE DIALOG oDlg RESOURCE "MainDlg" OF oWnd STYLE nSTYLE ; //  TRANSPARENT ;
TITLE  "Folder-Test" FONT oFont

REDEFINE FOLDER oFld ID 100 OF oDlg UPDATE ;
PROMPTS "  &Page 1  ", "   &Page 2   ", "  &Page 3  ", "  &Page 4  " ;
DIALOGS "Page1", "Page2", "Page3", "Page4" FONT oFont ;
ON CHANGE( SetFolder( oWnd, oFld, nOption, nOldOption ) )

FOLDER_1(oDlg,oFld)  
FOLDER_2(oDlg,oFld)  
FOLDER_3(oDlg,oFld)  
FOLDER_4(oDlg,oFld)

ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT ( oDlg:Move( 30 , 10, oDlg:nWidth, oDlg:nHeight, .f. ), ;
            SetImages( oDlg, oFld ) ) ;
ON PAINT ( Degrade ( hDC, oWnd, 32768, 16777215 ), SetFoldGrad( oFld, 128, 16777215 ) )

RETURN NIL  

//------------ IMAGES for FOLDER-TABS --------------------------------------------

FUNCTION SetImages( oDlg, oFld )
local oImageList
   
DEFINE IMAGELIST oImageList SIZE 16, 16
   
oImageList:AddMasked( TBitmap():Define( "New",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "Open",,     oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "Print",,   oDlg ), nRGB( 192, 192, 192 ) )    
oImageList:AddMasked( TBitmap():Define( "Search",,   oDlg ), nRGB( 192, 192, 192 ) )    

oFld:SetImageList( oImageList )
   
RETURN NIL  

//------------------- ACTIONS before TAB-SELECT -----------------------------------------------

STATIC FUNCTION SetFolder( oWnd, oFld, nOption, nOldOption )

IF nOption == 1
    MsgAlert( "Action Page 1", "Attention" )
ENDIF    
IF nOption == 2
    MsgAlert( "Action Page 2", "Attention" )
ENDIF
IF nOption == 3
    MsgAlert( "Action Page 3", "Attention" )
ENDIF
IF nOption == 4
    MsgAlert( "Action Page 4", "Attention" )
ENDIF

RETURN .T.

// ---------- FOLDER-PAGE 1  --------------------

FUNCTION FOLDER_1(oDlg,oFld)


RETURN( NIL )

// ---------- FOLDER-PAGE 2  --------------------

FUNCTION FOLDER_2(oDlg,oFld)


RETURN( NIL )

// ---------- FOLDER-PAGE 3  --------------------

FUNCTION FOLDER_3(oDlg,oFld)


RETURN( NIL )

// ---------- FOLDER-PAGE 4  --------------------

FUNCTION FOLDER_4(oDlg,oFld)


RETURN( NIL )
 


The Resource ( the Tab-Bitmaps You can find in FWH => \bitmaps\16x16 )
---------------------------------------------------------------------------------------

Code: Select all | Expand


#ifdef __FLAT__
   1 24 "WindowsXP.Manifest"
#endif  

#define DIALOG_1    1
MAINDLG DIALOG 23, 52, 343, 270
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 10,"MS Sans Serif"
{
 CONTROL "", 100, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE, 43, 28, 255, 210
}

Page1 DIALOG -1, 76, 255, 210
STYLE WS_CHILD | WS_VISIBLE | WS_BORDER
FONT 10,"MS Sans Serif"
{
}

Page2 DIALOG -1, 76, 255, 210
STYLE WS_CHILD | WS_VISIBLE | WS_BORDER
FONT 10,"MS Sans Serif"
{
}

Page3 DIALOG -1, 76, 255, 210
STYLE WS_CHILD | WS_VISIBLE | WS_BORDER
FONT 10,"MS Sans Serif"
{
}

Page4 DIALOG -1, 76, 255, 210
STYLE WS_CHILD | WS_VISIBLE | WS_BORDER
FONT 10,"MS Sans Serif"
{
}

search BITMAP DISCARDABLE "search.bmp"
new BITMAP DISCARDABLE "new.bmp"
open BITMAP DISCARDABLE "open.bmp"
print BITMAP DISCARDABLE "print.bmp"
favorite ICON "favorite.ico"

 


Regards
Uwe :lol:

Re: More modern looking folders

Posted: Sat Apr 25, 2009 6:29 am
by HunterEC
Uwe:

Thank you for the post. Can you email me the rc file ? Just to look around on the object's properties. Thank you.

Re: More modern looking folders

Posted: Sat Apr 25, 2009 7:00 am
by anserkk
Dear Mr.HunterEC,

Mr.Uwe has already posted the .RC file also in his post.

Regards
Anser

Re: More modern looking folders

Posted: Sun Apr 26, 2009 7:59 am
by Otto
http://msdn.microsoft.com/en-us/library/dd371191(VS.85).aspx

Code: Select all | Expand

The Windows Scenic Ribbon (Ribbon) is a rich command presentation system that provides a modern alternative to the layered menus, toolbars, and task panes of traditional Windows applications. Similar in functionality and appearance to the Microsoft Office 2007 Fluent Ribbon, the Ribbon is a command bar that exposes the major features of an application through a series of tabs at the top of an application window.
 


Best regards,
Otto