Diable button bar 2007

Diable button bar 2007

Postby Rick Lipkin » Thu Sep 01, 2011 8: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: Select all  Expand view

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,  }
 


Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Diable button bar 2007

Postby nageswaragunupudi » Fri Sep 02, 2011 1: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
User avatar
nageswaragunupudi
 
Posts: 10641
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Diable button bar 2007

Postby jll-fwh » Sat Sep 03, 2011 1: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"

[img]
http://www.grupes.es/basura/cam10.jpg
[/img]

Code: Select all  Expand view

/*------------------------------------------------------------------------------*/
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
User avatar
jll-fwh
 
Posts: 408
Joined: Fri Jan 29, 2010 8:14 pm
Location: Meliana - Valencia

Re: Diable button bar 2007

Postby Rick Lipkin » Tue Sep 06, 2011 6: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: Select all  Expand view

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: Select all  Expand view


//-------------------------------
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

 


Image

Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Diable button bar 2007

Postby Antonio Linares » Tue Sep 06, 2011 6:52 pm

Rick,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Diable button bar 2007

Postby Rick Lipkin » Tue Sep 06, 2011 7:33 pm

Antonio

Thank you .. works great !

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests