FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BUTTON individual width on bar
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
BUTTON individual width on bar
Posted: 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 12:48 AM
Try

Code (fw): Select all Collapse
   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 (fw): Select all Collapse
   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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 05: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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 07: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



Code (fw): Select all Collapse
#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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 10:37 AM

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

EMG

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 03: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
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 03: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



Code (fw): Select all Collapse
#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... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: BUTTON individual width on bar
Posted: Sun Jul 30, 2017 03:36 PM
Code (fw): Select all Collapse
    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 (fw): Select all Collapse
    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

Continue the discussion