FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ButtonBmp without border
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
ButtonBmp without border
Posted: Thu Oct 23, 2008 04:01 PM

Is it possible to create a ButtonBmp without border?

How would be the code?

I've been working on it and I didn´t find a way to do it.

Thanks in advance.

Saludos/Regards,

José Murugosa

"Los errores en programación, siempre están entre la silla, el teclado y la IA!!"
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
Re: ButtonBmp without border
Posted: Thu Oct 23, 2008 11:48 PM
jose_murugosa wrote:Is it possible to create a ButtonBmp without border?

How would be the code?

I've been working on it and I didn´t find a way to do it.

Thanks in advance.


What I want is to change the get.... bitmap... action.... to this look

Saludos/Regards,

José Murugosa

"Los errores en programación, siempre están entre la silla, el teclado y la IA!!"
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
ButtonBmp without border
Posted: Fri Oct 24, 2008 04:46 AM

Jose,

clause ... GET ... ACTION ... creates a TButtonBmp control as a child control of the GET. Class TButtonBmp is inherited from Class TButton, based on the standard Windows buttons.

Though some resources editors, as MS VSX, shows an optional "flat" style for a button, when we test such style, the button still shows its border.

A possible solution would be to modify Class TGet and use a TBtnBmp instead of a TButtonBmp, but then you would not have themes support in the TBtnBmp button.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
ButtonBmp without border
Posted: Fri Oct 24, 2008 09:57 AM
Antonio Linares wrote:Jose,

clause ... GET ... ACTION ... creates a TButtonBmp control as a child control of the GET. Class TButtonBmp is inherited from Class TButton, based on the standard Windows buttons.

Though some resoures editors, as MS VSX, shows an optional "flat" style for a button, when we test such style, the button still shows its border.

A possible solution would be to modify Class TGet and use a TBtnBmp instead of a TButtonBmp, but then you would not have themes support in the TBtnBmp button.


Thanks for your answer, I suspect that this would be the only solution (sorry for my terrible english).
Saludos/Regards,

José Murugosa

"Los errores en programación, siempre están entre la silla, el teclado y la IA!!"
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
ButtonBmp without border
Posted: Fri Oct 24, 2008 10:14 AM

José,

Another possibility is to replace the TButtonBmp used in Class TGet with a TBitmap control. This way there will be no button borders at all.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1279
Joined: Mon Feb 06, 2006 04:28 PM
ButtonBmp without border
Posted: Fri Oct 24, 2008 02:45 PM
I add a variable lNoBorderBtn and I create a ButtonBmp when it is .f. and a BtnBmp with it is .t., now it works ok in both cases.

Thanks for your help Antono!! :-)

For those who could need this I leave the code:

After defining a variable lNoBorderBtn in method New and Redefine.....

METHOD CreateButton() CLASS TGet

   local oThis := Self
   
   if ValType( ::bAction ) == "B" .and. Upper( ::ClassName() ) == "TGET"
	 		//JSe modifica para que al indicar que no se desee borde en botón cambie a objeto btnbmp sin borde
			
      IF ::lNoBorderBtn
         IF Empty( ::cBmpName )  					//no hay bmp
				 	 @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
            	ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
            	SIZE ::nHeight - 4, ::nHeight - 4 PIXEL TRANSPARENT
			     ::oBtn:SetText( "..." )
    	   ELSE 
				/*  
         @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
            ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
            SIZE ::nHeight - 4, ::nHeight - 4 PIXEL BITMAP ::cBmpName
				*/
            IF At( ".", ::cBmpName)<>0  //si es .bmp 
         		   @0, ::nwidth - ::nHeight BTNBMP ::oBtn OF Self;
         		   ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
         		   FILE ::cBmpName ;
         		   SIZE ::nHeight - 4, ::nHeight - 4 PIXEL NOBORDER TRANSPARENT
            ELSE   //si es un bmp
         	   	 @0, ::nwidth - ::nHeight BTNBMP ::oBtn OF Self;
         		   ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
         		   RESOURCE ::cBmpName;
         		   SIZE ::nHeight - 4, ::nHeight - 4 PIXEL NOBORDER TRANSPARENT
            ENDIF
         ENDIF   
      ELSE
         if Empty( ::cBmpName )
            @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
               ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
               SIZE ::nHeight - 4, ::nHeight - 4 PIXEL
            if Empty( ::oBtn:hBitmap )
               ::oBtn:SetText( "..." )
            endif      
         else   
            @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
               ACTION ( Eval( oThis:bAction, oThis ), oThis:SetFocus() ) ;
               SIZE ::nHeight - 4, ::nHeight - 4 PIXEL BITMAP ::cBmpName
         endif   
      ENDIF
			::oBtn:lCancel = .T. // so the GET VALID is not fired when the button is focused
						      ENDIF   
   
return nil   

//----------------------------------------------------------------------------//
Saludos/Regards,

José Murugosa

"Los errores en programación, siempre están entre la silla, el teclado y la IA!!"

Continue the discussion