ButtonBmp without border

ButtonBmp without border

Postby jose_murugosa » Thu Oct 23, 2008 4: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 y el teclado y la IA!!"
User avatar
jose_murugosa
 
Posts: 1180
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: ButtonBmp without border

Postby jose_murugosa » 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

Image
Saludos/Regards,
José Murugosa
"Los errores en programación, siempre están entre la silla y el teclado y la IA!!"
User avatar
jose_murugosa
 
Posts: 1180
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Postby Antonio Linares » Fri Oct 24, 2008 4: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.
Last edited by Antonio Linares on Fri Oct 24, 2008 10:13 am, edited 1 time in total.
regards, saludos

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

Postby jose_murugosa » Fri Oct 24, 2008 9: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 y el teclado y la IA!!"
User avatar
jose_murugosa
 
Posts: 1180
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby jose_murugosa » Fri Oct 24, 2008 2: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!! :D

For those who could need this I leave the code:

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

Code: Select all  Expand view
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 y el teclado y la IA!!"
User avatar
jose_murugosa
 
Posts: 1180
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests