How to replace Button-Bmp's in Folder-Pages ( solved )

How to replace Button-Bmp's in Folder-Pages ( solved )

Postby ukoenig » Mon Sep 14, 2009 2:27 pm

Hello,

is it possible, to Update the Bitmaps ( for TButtonBMP ) in a Folder-Page,
defined new, inside another Page ?

My Problem :
Changing the Skin, works on Folder and Dialog.
Changing the Button-Bmp works only on Dialog.

Image

After a Folder-Page-Change, the Button shows still the old BMP, defined on Init.
Is it possible to Update the Buttons in Folder-Page 5 ( Repaint ) with the new BMP's from the BMP-Editor ???
The Array < aPICTURES[1][3] > stores the BMP's

REDEFINE BUTTONBMP oBtn1 ID 110 OF oFld:aDialogs[5] ;
ACTION MsgAlert("Test" ) ;
BITMAP aPICTURES[1][3] PROMPT "1. Btn (16x16)" TEXTRIGHT
oBtn1:cToolTip = { "TButtonBMP","Test", 1, CLR_BLACK, 14089979 }
oBtn1:oFont := oTextFont

Image

I used ( doesn't work ) :

Code: Select all  Expand view

REDEFINE FOLDER oFld ID 100 OF oDlg TRANSPARENT UPDATE ;
PROMPTS " &Dialog-Backgrd.", " &Normal / Focus / Pressed  ", " &Font / Border / Source / Activation  ", " &TButton-Test  ", "TButton&BMP-Test  " ;
DIALOGS "Painter", "Background", "Titles", "Buttons1", "Buttons2"   FONT oFoldFont ;
ON CHANGE( UPD_FOLDER( oFld, nOption, nOldOption ) )

//----------------------------------------------------------------------------//

STATIC FUNCTION UPD_FOLDER( oFld, nOption, nOldOption )
LOCAL n, oDlg

IF nOption == 5 // Buttons to be Updated
   FOR n = 1 to Len( oFld:aDialogs )
      oDlg = oFld:aDialogs[ n ]
      IF n = 5
         oDlg:bPainted = { | hDC | oFld:aDialogs[5]:Refresh() }
      ENDIF
   NEXT
ENDIF

RETURN .T.
 


The Function works perfect, to change the Background of Page 4 and 5
with the Background-Selection, done in Page 1

Code: Select all  Expand view

STATIC FUNCTION TEST_FOLD( oFld, nOption, nOldOption )
LOCAL n, oDlg

IF nOption > 3 // Background-Change only for Folder-Page 4 and 5
   // ------------------------------------------------------------------------
   FOR n = 1 to Len( oFld:aDialogs )
      oDlg = oFld:aDialogs[ n ]
      IF n > 3 .and. W_STYLE = 1 // Gradient
         IF W_DIRECT = 1
            oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
            oDlg:nWidth, { { W_MOVE, W_COLOR1, W_COLOR2 }, ;
            { W_MOVE, W_COLOR2, W_COLOR1 } }, .T. ) }
         ELSE
            oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
            oDlg:nWidth, { { W_MOVE, W_COLOR1, W_COLOR2 }, ;
            { W_MOVE, W_COLOR2, W_COLOR1 } }, .F. ) }
        ENDIF
      ENDIF
      IF n > 3 .and. W_STYLE = 2 // 1 Color
         oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
         oDlg:nWidth, { { W_MOVE, W_COLOR1, W_COLOR1 }, ;
         { W_MOVE, W_COLOR1, W_COLOR1 } }, .T. ) }
      ENDIF
   NEXT
ENDIF

RETURN .T.
 


Best regards
Uwe :lol:
Last edited by ukoenig on Tue Sep 15, 2009 11:00 pm, edited 2 times in total.
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: How to Update Button-Bmp's on Folder-Page-Change ?

Postby ukoenig » Tue Sep 15, 2009 12:15 pm

Hello,

I tested this Function, to change the Button-BMP's in a Folder.
The Buttons are selected in Folder-Page 5 ( ButtonBMP-Preview ) from the Function.
It works like expected now. I can change the BMP's at Runtime.

It is just a Test. The Tools uses different BMP's.
Scanning the Controls, is there a Function, returns the ID-Number of a Control from the Resource ???
IF "TBUTTONBMP" $ oControl:ClassName() .and. nID = 100
...
...
As long the ID-Numbers are in Line like 100, 101, 102... there is no Problem.

Image

Code: Select all  Expand view

FUNCTION BMP_CHANGE( oFld )
LOCAL n, n1, oDlg, oBrush, oControl
   
FOR n = 1 to Len( oFld:aDialogs )
   oDlg = oFld:aDialogs[ n ]  
   IF n = 5 // Changing all Button-BMP's in Folder-Page 5
       // --------------------------------------------------------
       FOR n1 = 1 to Len(oDlg:aControls)
          oControl:= oDlg:aControls[ n1 ]
          IF "TBUTTONBMP" $ oControl:ClassName()
             oControl:LoadBitmap( c_path + "\IMAGES\16x16\Help.bmp" )
             oControl:Refresh()
          ENDIF
      NEXT
   ENDIF
NEXT
RETURN NIL    
 


Using the Function, to replace the 3. Button-BMP 32x32 < Magic.bmp > with < Help.bmp >

Image

Image
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: Google [Bot] and 75 guests