BUTTON individual width on bar

BUTTON individual width on bar

Postby TimStone » Sun Jul 30, 2017 12:40 am

Using a button bar, most buttons fit in the size I set on the bar of 60,60. However, I would like to add a button that is twice the width of others. DEFINE BUTTON has no SIZE option, and ADJUST just scrunches it all in the 60,60 space set. Is there anyway to allow an individual button to be twice the width of all the others ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2946
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: BUTTON individual width on bar

Postby cnavarro » Sun Jul 30, 2017 12:48 am

Try

Code: Select all  Expand view  RUN

   DEFINE BUTTONBAR oBar SIZE 48, 48 OF oWnd
   DEFINE BUTTON oBtt1 PROMPT "Salir" OF oBar ACTION oWnd:End() TOOLTIP "Salir"
   oBtt1:nWidth := 96

 


or

Code: Select all  Expand view  RUN

   DEFINE BUTTONBAR oBar SIZE 48, 48 OF oWnd
   DEFINE BUTTON PROMPT "Salir" OF oBar ACTION oWnd:End() TOOLTIP "Salir"
   oBar:aControls[ 1 ]:nWidth := 96
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUTTON individual width on bar

Postby TimStone » Sun Jul 30, 2017 5:31 am

Unfortunately those do not work.

The first option does not change the width.

The second option provides a create error ...

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2946
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: BUTTON individual width on bar

Postby cnavarro » Sun Jul 30, 2017 7:23 am

TimStone wrote:Unfortunately those do not work.

The first option does not change the width.

The second option provides a create error ...

Tim


My sample run OK

Image

Code: Select all  Expand view  RUN


#include "Fivewin.ch"

Function Main()

   local oWnd
   local oBar
   local oBtt1
   local oBtt2

   DEFINE WINDOW oWnd FROM 0, 0 TO 660, 1100 TITLE "Test" PIXEL

      DEFINE BUTTONBAR oBar SIZE 48, 48 OF oWnd
      DEFINE BUTTON oBtt1 PROMPT "Salir" OF oBar ACTION oWnd:End() TOOLTIP "Salir"
      oBtt1:nWidth := 96
      // or, also run OK
      //oBar:aControls[ 1 ]:nWidth := 96
      DEFINE BUTTON oBtt2 PROMPT "Test" OF oBar ACTION ( MsgInfo( "Test" ) ) TOOLTIP "Test"
   
   ACTIVATE WINDOW oWnd

Return NIL

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUTTON individual width on bar

Postby Enrico Maria Giordano » Sun Jul 30, 2017 10:37 am

Works fine for me too. Great, I wasn't aware of it, thank you! :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: BUTTON individual width on bar

Postby TimStone » Sun Jul 30, 2017 3:01 pm

The buttonbar is on a DIALOG.


Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2946
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: BUTTON individual width on bar

Postby joseluisysturiz » Sun Jul 30, 2017 3:12 pm

cnavarro wrote:
TimStone wrote:Unfortunately those do not work.

The first option does not change the width.

The second option provides a create error ...

Tim


My sample run OK

Image

Code: Select all  Expand view  RUN


#include "Fivewin.ch"

Function Main()

   local oWnd
   local oBar
   local oBtt1
   local oBtt2

   DEFINE WINDOW oWnd FROM 0, 0 TO 660, 1100 TITLE "Test" PIXEL

      DEFINE BUTTONBAR oBar SIZE 48, 48 OF oWnd
      DEFINE BUTTON oBtt1 PROMPT "Salir" OF oBar ACTION oWnd:End() TOOLTIP "Salir"
      oBtt1:nWidth := 96
      // or, also run OK
      //oBar:aControls[ 1 ]:nWidth := 96
      DEFINE BUTTON oBtt2 PROMPT "Test" OF oBar ACTION ( MsgInfo( "Test" ) ) TOOLTIP "Test"
   
   ACTIVATE WINDOW oWnd

Return NIL

 


Excelente, siempre quise hacer eso pero crei ajuro todos los botones llevaban el mismo tamaño, eso le pasa a uno por no leer las letras "chiquitas" en las CLASES, jeje. Gracias Navarro, como siempre sorprendiendo con tus aportes y ayudas...saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: BUTTON individual width on bar

Postby TimStone » Sun Jul 30, 2017 3:36 pm

Code: Select all  Expand view  RUN


    REDEFINE BUTTONBAR oBar2 ID 102 SIZE 60,60 OF oFld:aDialogs[ 1 ] 2015
            oBar2:bClrGrad := aPubGrad

    DEFINE BUTTON oBtn2b OF oBar2 RESOURCE "HRSAVE"  PROMPT "Save" TOOLTIP "Save General Data" ;
        ACTION ( ::saveWO( ), oFld:update( ) )
       
    DEFINE BUTTON oBtn2c OF oBar2 RESOURCE "CFXMBR" PROMPT "myCARFAX" TOOLTIP "myCarfax" ACTION MsgInfo( "Working" )
    oBtn2c:nWidth := 120

 


All buttons, including the one I want to resize, are 60x60. In this application, there is a button bar on the dialog itself, and one on each of 8 folders. All work perfectly ... but would love to resize this one button to a double width.

PLEASE NOTE: Because this is on a DIALOG, using resources, we have to use REDEFINE for the button bar. Thus, on the .rc file we define the button bar as:
Code: Select all  Expand view  RUN
   CONTROL                 "", 102, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 660, 30
 


What is happening is that the class is resizing the bitmap so it displays the full image, but in a 60x60 button rather than a 60x120 button, which makes it too small to read. Also, the button would normally be displayed without PROMPT, which I added here just for testing.

If you look at the DEFINE vs REDEFINE code for the button bar, you will see there is a significant difference which may lead to this problem.

I am using FWH 17.06, Harbour, MSVC++ 2017

Tim
Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2946
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 49 guests