ButtonBar display problems

ButtonBar display problems

Postby TimStone » Tue Jul 19, 2016 9:36 pm

Using a button bar, defined as:
REDEFINE BUTTONBAR oBarCL ID 101 SIZE 60,60 OF oFldCSE:aDialogs[1] 2015
oBarCL:bClrGrad := aPubGrad

And a resource:
CONTROL "", 101, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 645, 30
In a dialog, 650 wide

There are two problems:

1) The bar does not extend past the last button. In the past, and in a window, it covers the full width of the screen.
2) The background is a gradient. All buttons are Alpha Bitmaps. However, some buttons do not have the gradient background. It is missing. It might be one button, or 2 to 3 buttons in a row.

This behavior is happening on all BUTTONBAR controls used in dialogs.

Help ?
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: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: ButtonBar display problems

Postby cnavarro » Tue Jul 19, 2016 9:58 pm

Tim, modify with your gradient in this sample, try and post it
Sample:

Code: Select all  Expand view


#include "fivewin.ch"

function main()

   local oDlg, oBar, oFont, oBrw

   USE STATES

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE DIALOG oDlg RESOURCE "timbar" TITLE "FWH 16.05 BUTTONBAR FROM RESOURCE" FONT oFont

   REDEFINE BUTTONBAR oBar ID 100 OF oDlg 2015

   DEFINE BUTTON OF oBar PROMPT "Add"     GROUP FILE "..\bitmaps\AlphaBmp\down.bmp" //32x32\new.bmp"
   DEFINE BUTTON OF oBar PROMPT "Edit"    GROUP FILE "..\bitmaps\AlphaBmp\GMail.bmp" //32x32\edit.bmp"
   DEFINE BUTTON OF oBar PROMPT "Delete"  GROUP FILE "..\bitmaps\AlphaBmp\Graphics.bmp" //delete.bmp"
   DEFINE BUTTON OF oBar PROMPT "Print"   GROUP FILE "..\bitmaps\AlphaBmp\floppy.bmp" //print32.bmp"
   DEFINE BUTTON OF oBar PROMPT "Quit"    GROUP FILE "..\bitmaps\AlphaBmp\question.bmp" ACTION oDlg:End() //32x32\exit.bmp"


   REDEFINE XBROWSE oBrw ID 101 OF oDlg DATASOURCE Alias() AUTOCOLS FOOTERS

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil

 


Code: Select all  Expand view


#include <windows.h>

timbar DIALOG 0, 0, 400, 200
STYLE DS_MODALFRAME | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
FONT 8, "MS Sans Serif"
CAPTION "Test"
BEGIN
   CONTROL "", 100, "TBar", 0 | WS_CHILD | WS_VISIBLE,   0, 0, 480, 40
   DEFPUSHBUTTON   "OK", IDOK, 40, 168, 50, 14, WS_VISIBLE
   PUSHBUTTON      "Cancel", IDCANCEL, 101, 168, 50, 14, WS_VISIBLE
   CONTROL "", 101, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 50, 360, 100
END
 
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: ButtonBar display problems

Postby TimStone » Tue Jul 19, 2016 11:37 pm

Here is the gradient.

PUBLIC aPubGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
{ 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }

Please note my bitmaps are in the .rc file so it's not "the same"
Also, in your example, your dialog is 400 wide and your bar is 480 wide.

The bar now has this behavior in every single dialog where one is used. There are NO exceptions. The gradient only applies to ( most ) buttons but not all, and the bar only extends to the end of the last button.
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: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: ButtonBar display problems

Postby cnavarro » Wed Jul 20, 2016 1:08 am

Ok, I understand the differences
I'll try with your instructions
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: ButtonBar display problems

Postby ukoenig » Wed Jul 20, 2016 9:01 am

Tim,

I added a buttonbar to my new sample
instead of a RC-file for images I used a DLL
I cannot see any wrong paintings
All selected buttons are painted transparent.

http://www.pflegeplus.com/DOWNLOADS/Dlltest1.zip
( still the part from RC / DLL is under construction )

1) The bar does not extend past the last button.
In the past, and in a window, it covers the full width of the screen.
2) The background is a gradient. All buttons are Alpha Bitmaps.
However, some buttons do not have the gradient background.
It is missing. It might be one button, or 2 to 3 buttons in a row.


Image

...
...
aPubGrad := { | lInvert | If( ! lInvert, { { 0.50,16776960,16777215 }, ;
{ 0.50,16777215,16776960 } }, { { 0.50,128,16777215 }, { 0.50,16777215,128 } } ) }

from CODE

DEFINE DIALOG oDlg1 TITLE "Test folder from CODE" SIZE 650, 550 PIXEL OF oWnd BRUSH oBrush0

DEFINE BUTTONBAR oBar SIZE 60, 30 OF oDlg1 2015
oBar:bClrGrad := aPubGrad

DEFINE BUTTON OF oBar PROMPT "Paint" GROUP RESOURCE "COLORS" FONT oFont1 // bitmaps from DLL
DEFINE BUTTON OF oBar PROMPT "Edit" GROUP RESOURCE "CODE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "View" GROUP RESOURCE "FONTS" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Create" GROUP RESOURCE "RESOURCE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Quit" GROUP RESOURCE "EXIT" ACTION oDlg1:End() FONT oFont1
...
...


from RESOURCE

SetResources( hSave ) // RC-file

DEFINE DIALOG oDlg2 RESOURCE "DPainter" BRUSH oBrush0 PIXEL ;
FONT oFont1 TITLE "Test folder from RESOURCES" OF oWnd

REDEFINE BUTTONBAR oBar ID 100 OF oDlg2 2015
oBar:bClrGrad := aPubGrad
...
...
SET RESOURCES TO c_path + "SYSTEM.dll" // select from DLL

DEFINE BUTTON OF oBar PROMPT "Paint" GROUP RESOURCE "COLORS" FONT oFont1 // bitmaps from DLL
DEFINE BUTTON OF oBar PROMPT "Edit" GROUP RESOURCE "CODE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "View" GROUP RESOURCE "FONTS" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Create" GROUP RESOURCE "RESOURCE" FONT oFont1
DEFINE BUTTON OF oBar PROMPT "Quit" GROUP RESOURCE "EXIT" ACTION oDlg1:End() FONT oFont1
...
...
SetResources( hSave ) // access from rc

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: ButtonBar display problems

Postby TimStone » Wed Jul 20, 2016 5:31 pm

Actual code:
Code: Select all  Expand view

FUNCTION list01
    // Labor rates list01
    //  Updated:    7/28/2015 2:59:33 PM
   
    LOCAL oBarLst
    PRIVATE oDepartment, oEdit, lFirst := .F.
    // Open the labor rate reference database and index
    oLaborRate := tLaborRate():New( )
    IF oLaborRate:reccount( ) = 0
        MsgAlert( "Adding a first record")
        oLaborRate:append( )
        oLaborRate:save( )
        lFirst := .T.
    ENDIF
    oLaborRate:gotop()
    oLaborRateR := TRecord():new( oLaborRate )
    oLaborRateR:load()
    // Open the dialog using a resource from EMS.DLL
    DEFINE DIALOG oDlg RESOURCE "LISTS"  BRUSH oBrush transparent OF oWnd TITLE "Labor Rates"
    oDlg:nHelpID := 5
    // Build the edit controls
    REDEFINE SAY oSa1 PROMPT "Charge" ID 4900 OF oDlg
    REDEFINE GET oEdit VAR oLaborRateR:charge ID 102 OF oDlg PICTURE "$99999.99" MESSAGE "The charge for this service" UPDATE
    REDEFINE SAY oSa2 PROMPT "Service" ID 4901 OF oDlg
    REDEFINE GET oLaborRateR:servic ID 103 OF oDlg MESSAGE "A description of the service type" UPDATE

    // Create the BROWSE control
    REDEFINE  XBROWSE oLbx1 ;
      DATASOURCE oLaborRate ;
      HEADERS " Charge ", " Service ", " " ;
      COLUMNS "charge", "servic", " " ;
      ID 101 OF oDlg ;
      ON CHANGE ( oLaborRateR:load(), oDlg:update()) ;
      UPDATE

    // Provide the header gradient
    oLbx1:bClrGrad := aPubGrad
    // Set the styles
    oLbx1:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oLbx1:nColDividerStyle := LINESTYLE_RAISED
    oLbx1:nRowDividerStyle := LINESTYLE_RAISED
    oLbx1:nHeadStrAligns  := AL_CENTER
    oLbx1:nStretchCol := STRETCHCOL_LAST

    REDEFINE BUTTONBAR oBarLst ID 105 SIZE 60,60 OF oDlg 2015
    oBarLst:bClrGrad := aPubGrad
   
    // Build the button controls
    DEFINE BUTTON OF oBarLst RESOURCE "HRADD" PROMPT "Add" TOOLTIP "Add a record" ;
        ACTION ( oLbx1:gobottom(), oLaborRate:append( ), oLaborRate:blank( ), oLbx1:refresh(), oLaborRateR:load(), oDlg:update( ),;
        oEdit:setfocus( ) ) MESSAGE "Add a new item"
    DEFINE BUTTON OF oBarLst RESOURCE "HRSAVE" PROMPT "Save" TOOLTIP "Save changes" ;
        ACTION ( oLaborRateR:save( ), oDlg:update( ), oLbx1:refresh(), oLbx1:setfocus( ) ) ;
        MESSAGE "Save any changes made to the current item"
    DEFINE BUTTON OF oBarLst RESOURCE "HRDELETE" PROMPT "Delete" TOOLTIP "Delete selected record" ;
        ACTION ( IIF( MsgYesNo( "Do you wish to delete this item ?"), ( oLaborRate:delete( ),;
        oLaborRate:skip(1), oLbx1:refresh(), oLaborRateR:load(), oDlg:update()),))  MESSAGE "Delete the current item"
    DEFINE BUTTON OF oBarLst RESOURCE "HRHELP"  PROMPT "Help"   TOOLTIP "Open OnLine Manual" ;
        ACTION WinExec( "hh asw9.chm" )
    DEFINE BUTTON OF oBarLst RESOURCE "HREXIT" PROMPT "Exit" TOOLTIP "Exit this list" ;
        ACTION oDlg:end() MESSAGE "Exit this list"

    // Activate the dialog screen
    ACTIVATE DIALOG oDlg ON INIT oReBar:hide( ) CENTERED
    // Redisplay the bar
    oReBar:show()
    // Close the file
    oLaborRate:close()

RETURN NIL

 


.RC code, assembled into the .exe

Code: Select all  Expand view

LISTS DIALOG 0, 0, 660, 410
STYLE WS_POPUP | WS_CAPTION
CAPTION "List Editor"
{
    CONTROL                 "", 105, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 660, 30
    CONTROL         "",101,"TxBrowse",WS_BORDER | WS_VSCROLL | WS_TABSTOP,10,80,640,310
    EDITTEXT        102,110,40,200,13
    EDITTEXT        103,110,55,200,13
    LTEXT           "",4900,10,40,95,13
    LTEXT           "",4901,10,55,95,13
}

 


The result:

Image
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: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: ButtonBar display problems

Postby TimStone » Wed Jul 20, 2016 6:12 pm

Here is another case:

1) The same bmps ( all Alpha, 32x32 ) display correctly in other bars and then this one is a total mess. ( No gradients ) Compare this to the picture above using the same icons where the gradient is fine.
2) The behavior is the same using Harbour / MSVC 2015 or using xHarbour ( .com )
3) This is the latest FWH.

Image
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: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: ButtonBar display problems

Postby cnavarro » Wed Jul 20, 2016 8:01 pm

Tim
The problem is the use of transparent clause in the definition of dialogue ( then BUTTONBAR show ok, also transparent )

DEFINE DIALOG oDlg RESOURCE "LISTS" BRUSH oBrush transparent OF oWnd TITLE "Labor Rates"


Please try

Code: Select all  Expand view


ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBar:lTransparent := .F. )
 
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: ButtonBar display problems

Postby Antonio Linares » Wed Jul 20, 2016 10:27 pm

This would be convenient to have the default focus:

ON INIT ( oBar:lTransparent := .F., .T. )
regards, saludos

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

Re: ButtonBar display problems

Postby TimStone » Wed Jul 20, 2016 11:25 pm

Take a look at the last screen shot I provided.

Adding this change, the bar extends the full width of the dialog, BUT the buttons you see without the gradient background still have no background.

I discovered the problem on those finally. In the past, the bitmap buttons used the TRANSPARENT clause. I left that in place when I converted to putting the button bar inside the dialog. It worked fine until recently. Now it has become a problem. Removing the TRANSPARENT from the button commands fixes the problem.
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: 2944
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: No registered users and 85 guests