FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Diable button bar 2007
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Diable button bar 2007
Posted: Thu Sep 01, 2011 08:49 PM
To All

I have never used button bars ( believe it or not ) and I have created a Bar with the 2007 clause .. I want to Disable the bar when I open a new detail window and I have successfully done that because the buttons definitely will not work .. but I was hoping the icons would grey out to visually show they are disabled but this is not the case.

The Icons used are alpha blend bitmaps .. don't know if that has any bearing on the subject .. just curious if there is a way when I oBar2:Disable() .. the bitmaps would 'grey out' ??

Thanks
Rick Lipkin

Code (fw): Select all Collapse
DEFINE BUTTONBAR oBar2 OF oWndMDI SIZE 100,80 3DLOOK 2007
oBar2:SetColor(0)

DEFINE BUTTON oBtn1 OF oBar2 FILENAME ( cDEFA+"\ICONS\HOMEADD.BMP" ) ;
MESSAGE "Add Property Info" ;
ACTION nil ; //_PropBrow( oWnd,oBar )   ;
PROMPT "Add Property Info"
oBtn1:cToolTip := { " " + CRLF + "Button 1", "1. Button", 1, CLR_BLACK, 14089979  }

DEFINE BUTTON oBtn2 OF oBar2 FILENAME ( cDEFA+"\ICONS\HOMEFIND.BMP" ) ;
MESSAGE "Find a Property" ;
ACTION( _PropFind( oRsProp ),oBrw:ReFresh(),SysReFresh() ) ;
PROMPT "Find a Property"
oBtn2:cToolTip := { " " + CRLF + "Button 2", "2. Button", 1, CLR_BLACK, 14089979  }

DEFINE BUTTON oBtn3 OF oBar2 FILENAME ( cDEFA+"\ICONS\CLOSE.BMP" ) ;
MESSAGE "Close Browse" ;
ACTION ( oWnd1:End() ) ;
PROMPT "Close Property"
oBtn3:cToolTip := { " " + CRLF + "Close Property Browse", "Close", 1,  }


Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Diable button bar 2007
Posted: Fri Sep 02, 2011 01:10 AM

We can specify upto four bitmaps for each button. If specified 3rd bitmap is painted when the button is disabled.

Regards



G. N. Rao.

Hyderabad, India
Posts: 408
Joined: Fri Jan 29, 2010 08:14 PM
Re: Diable button bar 2007
Posted: Sat Sep 03, 2011 01:08 AM
Hola;

Como dice nages.

Aqui te dejo una funcion completa y unas imagenes.

El truco esta aqui, repetir 3 veces el mismo Bitmap:
DEFINE BUTTON RESOURCE "MenuP_Media","MenuP_Media","MenuP_Media"

http://www.grupes.es/basura/cam10.jpg
" alt="" loading="lazy">

Code (fw): Select all Collapse
/*------------------------------------------------------------------------------*/
Function FrameBar( oWnd )
/*------------------------------------------------------------------------------*/
     LOCAL oCursor, oFont
     // para desactivar botones sin usar var de objetos oBar:aControls[3]:Disable()
     // para mantener el boton hundido oBar:aControls[3]:Toggle()
     //`para subr el boton oBar:aControls[3]:GoUP()
     DEFINE CURSOR oCursor HAND
     DEFINE FONT oFont NAME "Tahoma" SIZE 0,-12
     DEFINE BUTTONBAR oBar _3D SIZE 75, 60 OF oWnd

     DEFINE BUTTON RESOURCE "MenuP_Media","MenuP_Media","MenuP_Media";
            NOBORDER OF oBar;
            ACTION ( oWebCam:Initialize(),;
                     If( oWebCam:isConnected,;
                       ( oWnd:oMsgBar:cMsgDef := "WebCam: Conectada",;
                         oWnd:oMsgBar:Refresh()),));
            TOOLTIP "Conectar la WebCam";
            FONT oFont;
            PROMPT "Conectar";
            WHEN ! oWebCam:isConnected

     DEFINE BUTTON RESOURCE "MenuP_Media","MenuP_Media","MenuP_Media";
            NOBORDER OF oBar;
            ACTION ( oWebCam:Finalize(),;
                     If( !oWebCam:isConnected,;
                       ( oWnd:oMsgBar:cMsgDef := "WebCam: Desconectada",;
                         oWnd:oMsgBar:Refresh()),));
            TOOLTIP "Desconectar la WebCam";
            FONT oFont;
            PROMPT "Desconectar";
            WHEN oWebCam:isConnected

     AEval( oBar:aControls, { | o | o:oCursor := oCursor } )

     oBar:bRClicked := {|| NIL }
     oWnd:lBalloon  := .T.

     DeleteObject( oFont )
     DeleteObject( oCursor )

Return( oBar )


Un slaudo
JLL
Msn: fwh-jll@hotmail.es
Libreria: FWH/FWH1109 + Harbour 5.8.2 + Borland C++ 5.8.2
Editor de Recursos: PellecC
ADA, OURXDBU
S.O: XP / Win 7 /Win10
Blog: http://javierlloris.blogspot.com.es/
e-mail: javierllorisprogramador@gmail.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Diable button bar 2007
Posted: Tue Sep 06, 2011 06:14 PM
To All

Thank everyone for their input .. I must be doing something wrong .. Here are the snipits of code to create the button on the button bar .. then I pass the button bar object to the next mdichild where I disable the bar and unfortunitly, the close button never greys out using the dclose.bmp bitmap ..

What am I missing ??

Thanks
Rick Lipkin

Code (fw): Select all Collapse
DEFINE BUTTON oBtn3 OF oBar2 FILENAME ( cDEFA+"\ICONS\CLOSE.BMP" ), ;
                                      ( cDEFA+"\ICONS\DCLOSE.BMP" ),( cDEFA+"\ICONS\DCLOSE.BMP" ) ;
MESSAGE "Close Browse" ;
ACTION ( oWnd1:End() ) ;
PROMPT "Close Property"
oBtn3:cToolTip := { " " + CRLF + "Close Property Browse", "Close", 1,  }


then in the next mdichild ..

Code (fw): Select all Collapse
//-------------------------------
FUNC _PropView( cMODE, oRsProp, oWnd, oBAR2 )

...
...

oBar2:Disable()

DEFINE BRUSH oBrush FILENAME ( cDEFA+"\ICONS\GREY.BMP" )
DEFINE ICON oICO RESOURCE "WORLD"

nOPEN  := 0

DEFINE WINDOW oWndChild                  ;
       MDICHILD                          ;
       FROM 3,3 to 35,75                 ;
       NOSYSMENU                         ;
       NOZOOM                            ;
       NOMINIMIZE                        ;
       ICON oICO                         ;
       OF oWnd                           ;
       TITLE cTITLE

DEFINE DIALOG oProp RESOURCE "PROPVIEW" of oWndChild  ;
       BRUSH oBrush TRANSPARENT




Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Diable button bar 2007
Posted: Tue Sep 06, 2011 06:52 PM

Rick,

To disable a button you have to do oBtn3:Disable()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Diable button bar 2007
Posted: Tue Sep 06, 2011 07:33 PM

Antonio

Thank you .. works great !

Rick

Continue the discussion