FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour problem with tsbutton
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
problem with tsbutton
Posted: Sun Jun 14, 2009 03:21 PM
I use tsbutton and I must change the bitmaps

How I must make it ?

I try with it but it not refresh the button can U help me

Code (fw): Select all Collapse
#include "FiveWin.ch"
#include ".\ch\Tsbutton.ch"


#define OMBRELLONE_PRENOTATO  ".\BITMAPS\OMBRELLONI\AZZURRO.BMP"
#define OMBRELLONE_OCCUPATO    ".\BITMAPS\OMBRELLONI\ROSSO.BMP"
#define OMBRELLONE_LIBERO     ".\BITMAPS\OMBRELLONI\VERDE.BMP"

#define BMP_H        15
#define BMP_V        15


static oDlg

Function Main()

Local oDlg,oBtnCat
Local abtn[3]
local col:=10
 DEFINE DIALOG oDlg SIZE 600,280 TITLE "test button"



For n=1 to 3

   @  n, col  SBUTTON aBtn[n];
                       FILE OMBRELLONE_PRENOTATO,;
                            OMBRELLONE_OCCUPATO,;
                            OMBRELLONE_PRENOTATO,;
                            OMBRELLONE_PRENOTATO PIXEL ;
                          OF oDlg    BITMAP     SIZE  BMP_H,BMP_V   ACTION CHANGE(aBtn)



             col:=col+30
 next



           FOR EACH oBtnCat IN aBtn

                        aBtn[n]:bAction:={ |oBtn|menupopup( oBtn) }
           NEXT


ACTIVATE DIALOG oDlg CENTER

return nil

STATIC FUNCTION  MENUPOPUP( oBtn)
              Local oMenu, nRow,nCol
              Local aRect := GetClientRect( oBtn:hWnd )
                  MENU oMenu POPUP  2007
                       MENUITEM "&CCUPAZIONE"       ;
                               ACTION CHANGE(oBtn)

                         ENDMENU
                         ACTIVATE POPUP oMenu AT aRect[ 3 ] + 1, aRect[ 2 ] OF  oBtn
                         return nil





FUNCTION CHANGE(oBtn)
      oBtn:ChangeBitmap( {1,2,3,4}, { OMBRELLONE_OCCUPATO,;
                                      OMBRELLONE_LIBERO,;
                                           NIL,;
                                      OMBRELLONE_OCCUPATO }, .t.   )


      oBtn:refresh()
oDlg:refresh()
return nil
Best Regards, Saludos



Falconi Silvio

Continue the discussion