FWH 17.04 : Group Labels on ButtonBars

FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Sat Apr 22, 2017 3:43 pm

FWH 17.04 introduces facility to paint labels for groups of buttons.

Image

\fwh\samples\barlabel.prg
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBold

   DEFINE WINDOW oWnd TITLE "FWH17.04 : ButtonBar Group Labels"
   DEFINE BUTTONBAR oBar OF oWnd 2013 SIZE 56,56 HEIGHT 80

   oBold := oBar:oFont:Bold()
   oBar:oGrpFont  := oBold

   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\top.bmp" PROMPT "Top"  GROUP LABEL "NAVIGATE"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\goto.bmp" PROMPT "GoTo"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\bottom.bmp" PROMPT "Bottom"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\new2.bmp" PROMPT "Add"  GROUP LABEL "EDIT"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\edit.bmp" PROMPT "Edit"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\delete0.bmp" PROMPT "Delete"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\excel.bmp" PROMPT "Excel"  GROUP LABEL "EXPORT"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\pdf.bmp" PROMPT "PDF"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\printquick16.bmp" PROMPT "Print"
   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\16x16\exit2.bmp" PROMPT "Exit" GROUP

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oBold

return nil
 


1) This feature works for buttonbars having styles 2007 and above as well as 3D with NOBORDER
2) While defining the Buttonbar HEIGHT clause also is to specified. The height should be greater than the height of the buttons to accommodate the height of the font.
3) Optionally, oBar:oGrpFont can be assigned with font to be used to paint the labels. The font is to be released by the programmer after the window is closed.
4) Group label is to be defined while defining first button of a group as in the above sample.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 17.04 : Group Labels on ButtonBars

Postby joseluisysturiz » Sat Apr 22, 2017 5:08 pm

Excelent..!

Solo es colocar imagenes o hay acciones individuales como con la TRibbon.? gracias... :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: FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Sat Apr 22, 2017 5:33 pm

Normal buttonbar having buttons with whatever actions we assign.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 17.04 : Group Labels on ButtonBars

Postby TimStone » Mon May 01, 2017 11:36 pm

This works with a window, but I was looking forward to using it with dialogs that are established in a resource file ( using the tbar control ).

I tried some variations but it doesn't seem to respond there.

Also, please clarify specifying colors. My button bar uses a gradient, but the added line for the labels goes to grey. The notes would suggest I need to specify the button as:

DEFINE BUTTON OF oBar ........ [ GROUP [ LABEL "GroupLabel [COLORS f,b] ] ]"

So, if I want to have a group label of white on blue, according to this, I would type GROUP LABEL "GroupLabel COLORS B,W" That won't work. It just displays the whole string.

Finally, I love the BTNRIGHT option ... works fine on a window, but again, not on a dialog created with a resource. Again, the code here is using:

CONTROL "", 101, "TBar", 0|WS_CHILD|WS_VISIBLE, 0,0, 840, 40

And in the .prg:

REDEFINE BUTTONBAR oBarCL ID 101 SIZE 60,60 OF oFldCSE:aDialogs[1] 2015

And the button is:

DEFINE BUTTON oBtn0 OF oBarCL RESOURCE "HRHELP" PROMPT "Help" TOOLTIP "Open the online manual" ACTION WinExec( "hh asw10.chm" ) GROUP BTNRIGHT



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

Re: FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Tue May 02, 2017 3:19 am

GROUP LABEL "GroupLabel COLORS B,W"

Please use color constants like this:
Code: Select all  Expand view

GROUP LABEL "GroupLabel" COLORS CLR_WHITE,CLR_BLUE
 


This works with a window, but I was looking forward to using it with dialogs that are established in a resource file ( using the tbar control ).

We concede that we developed and tested on Window only. However, the way it is implemented now, it requires some extra work to make it work on Dialogs from Source/Resources.

Example of Dialog created by code:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBar

   DEFINE DIALOG oDlg SIZE 800,300 PIXEL TRUEPIXEL TITLE "USING WINGDINGS AS BITMAPS"

   DEFINE BUTTONBAR oBar OF oDlg SIZE 56,64 2013 HEIGHT 96

   DEFINE BUTTON OF oBar PROMPT "Back"    RESOURCE 0x100DF GROUP LABEL "Navigate" COLORS CLR_WHITE,CLR_HBLUE
   DEFINE BUTTON OF oBar PROMPT "Top"     RESOURCE 0x100E9
   DEFINE BUTTON OF oBar PROMPT "Bottom"  RESOURCE 0x100EA
   DEFINE BUTTON OF oBar PROMPT "Add"     RESOURCE 0x2002F GROUP LABEL "Edit" ;
      COLORS CLR_WHITE, { { 1, CLR_BLACK, CLR_WHITE }, .F. }
   DEFINE BUTTON OF oBar PROMPT "Edit"    RESOURCE 0x20022
   DEFINE BUTTON OF oBar PROMPT "Delete"  RESOURCE 0x20033
   DEFINE BUTTON OF oBar PROMPT "Save"    RESOURCE 0x1003C GROUP LABEL "Export" COLORS CLR_WHITE,CLR_GREEN
   DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE 0x30050
   DEFINE BUTTON OF oBar PROMPT "Setup"   RESOURCE 0x1005D BTNRIGHT

   AEval( oBar:aControls, { |oBtn| oBtn:bColorMap := { |o| If( o:lMOver, { CLR_BLACK, CLR_HRED }, nil ) } } )

   ACTIVATE DIALOG oDlg CENTERED //ON INIT DlgInit( oDlg, oBar )

return nil
/*
function DlgInit( oDlg, oBar )

   oBar:nBtnHeight      := oBar:nHeight - 30
   AEval( oBar:aControls, { |o| o:nHeight := oBar:nBtnHeight } )
   oBar:Refresh()

return nil
*/
 
 


Image

Example of Dialog from Resources:
Code: Select all  Expand view

#include "fivewin.ch"

REQUEST DBFCDX

function main()

   local oDlg, oBar, oFont, oBrw

   USE CUSTOMER NEW SHARED ALIAS CUST VIA "DBFCDX"

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

   DEFINE DIALOG oDlg RESOURCE "timbar" TITLE FWVERSION FONT oFont

   REDEFINE BUTTONBAR oBar ID 100 OF oDlg 2013 SIZE 80,90

   DEFINE BUTTON OF oBar PROMPT "Add"     FILE "c:\fwh\bitmaps\32x32\new.bmp" GROUP LABEL "Edit" COLORS CLR_WHITE,CLR_GREEN
   DEFINE BUTTON OF oBar PROMPT "Edit"    FILE "c:\fwh\bitmaps\32x32\edit.bmp"
   DEFINE BUTTON OF oBar PROMPT "Delete"  FILE "c:\fwh\bitmaps\delete.bmp"     GROUP LABEL "Two" COLORS CLR_WHITE,CLR_BLUE
   DEFINE BUTTON OF oBar PROMPT "Print"   FILE "c:\fwh\bitmaps\print32.bmp"
   DEFINE BUTTON OF oBar PROMPT "Quit"    FILE "c:\fwh\bitmaps\32x32\exit.bmp"  ACTION oDlg:End() BTNRIGHT

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

   REDEFINE SAY oBrw:oSeek VAR oBrw:cSeek ID 4002 OF oDlg COLOR CLR_HRED,CLR_YELLOW

   ACTIVATE DIALOG oDlg CENTERED //ON INIT DlgInit( oDlg, oBar )

   RELEASE FONT oFont

return nil
/*
static function DlgInit( oDlg, oBar )

   oBar:nBtnHeight   := oBar:nHeight - 35
   oBar:nWidth       := oDlg:nWidth - 4
   AEval( oBar:aControls, { |o| o:nHeight := oBar:nBtnHeight } )
   oBar:Refresh()

return nil
*/


 


Resource file:
Code: Select all  Expand view

// RESOURCE SCRIPT generated by "Pelles C for Windows, version 8.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

TIMBAR DIALOG DISCARDABLE 0, 0, 448, 244
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
EXSTYLE WS_EX_CLIENTEDGE|WS_EX_TRANSPARENT
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
  CONTROL "", 100, "TBar", 0x00000000, 0, 0, 448, 75
  CONTROL "OK", IDOK, "Button", BS_DEFPUSHBUTTON|WS_TABSTOP, 316, 208, 50, 20
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 380, 208, 50, 20
  CONTROL "", 101, "TXBrowse", WS_TABSTOP, 12, 112, 416, 84
  CONTROL "cSeek", 4002, "Static", WS_GROUP, 40, 84, 356, 16, WS_EX_CLIENTEDGE
}
 


Image

We shall be glad if you can test variants of the above samples and let us know if you encounter any problems.

Incidentally, the above samples also demonstrate using horizontal gradients as label backgrounds.

We are working on making these features work as straight forward as possible similar to window by either eliminating or reducing the requirement of extra code. So you may now try the above examples only for testing and reporting any problems. Please do not start implementing for dialogs in your regular applications till we come back again on this subject.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Tue May 02, 2017 2:41 pm

Mr Tim

We revised the bar.prg
Now we can create labels for buttonbars on dialogs, both from source code as well as resources, the same way as with Windows.
I have revised the above source code for dialogs I posted yesterday that will work with the revised bar.prg

Points to be kept in mind:

Both Window / Dialog from Source code

We should specify both SIZE <btnwidth>, <btnheight> and HEIGHT <nbarheight>
nBarHeight should be greater than <btnheight> atleast by 22 pixels to accommodate the label.


Dialog from Resources:

We should specify SIZE <btnwidth>, <btnheight>
Bar height is decided by the resource.
<btnheight> should be atleast 22 pixels shorter than the bar height.
In the existing cases, redesign of the rc file may be necessary to increase the height of the bar.

I suggest first trying the above samples without any changes and then later try to adopt to your individual dialogs.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 17.04 : Group Labels on ButtonBars

Postby TimStone » Tue May 02, 2017 4:36 pm

I will work with it today.
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: 2897
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: FWH 17.04 : Group Labels on ButtonBars

Postby TimStone » Tue May 02, 2017 6:09 pm

OK ... Some thoughts on this:

1) The button bar is a gradient. It would be nice if this could inherit from the existing button bar color.

2) Placing a button to the right (BTNRIGHT ) on a window keeps the bitmap properly centered. However, there is a spacing problem. Without using the LABEL and BTNRIGHT parameters, the button bar will fill the entire width of the dialog. ( ie. in a folder, the width in the .rc is 845. Tbar is set to 844 ). This is the proper behavior, but when applying the BTNRIGHT, the bar now falls about 15 points short, leaving the normal dialog background exposed. This is clearly in the calculation of the LABEL because commenting out BTNRIGHT does not change the erroneous length.

3) The 2nd line goes directly below the buttons to which it applies. However, If I use the command to send one or more buttons to the right, the space between the last left button and the first right button defaults to it's own color. To clarify, the button bar will automatically extend across the full dialog, and we now have it so the gradient applies to the full bar. However, the label area for a group does not behave in the same way.

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

Re: FWH 17.04 : Group Labels on ButtonBars

Postby ukoenig » Fri May 12, 2017 2:37 pm

Mr. Rao

using bar-labels from dialog is not included for the moment ?

I noticed TOP is not shown

I added the sample to my new sample-tool
It is easy to use and works fine.
Testing saves a lot of time.

----- The 3. radio-group is used for dialog-tests ------------

Maybe still adding another 4 radios ( new group ) using / testing from windows ?

First test-selection of group 3
The dialogtitle shows the text of the selected radio (textarray)

FUNCTION F3_PAGE1() // 3. group / 1. testdialog
LOCAL oBar

DEFINE BUTTONBAR oBar OF oDlg1 SIZE 56,64 2013 HEIGHT 96

oBar:oGrpFont := oLarge

DEFINE BUTTON OF oBar PROMPT "Back" RESOURCE 0x100DF GROUP LABEL "Navigate" COLORS CLR_WHITE,CLR_HBLUE
DEFINE BUTTON OF oBar PROMPT "Top" RESOURCE 0x100E9 // missing !!!
DEFINE BUTTON OF oBar PROMPT "Bottom" RESOURCE 0x100EA
DEFINE BUTTON OF oBar PROMPT "Add" RESOURCE 0x2002F GROUP LABEL "Edit" ;
COLORS CLR_WHITE, { { 1, CLR_BLACK, CLR_WHITE }, .F. }
DEFINE BUTTON OF oBar PROMPT "Edit" RESOURCE 0x20022
DEFINE BUTTON OF oBar PROMPT "Delete" RESOURCE 0x20033
DEFINE BUTTON OF oBar PROMPT "Save" RESOURCE 0x1003C GROUP LABEL "Export" COLORS CLR_WHITE,CLR_GREEN
DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE 0x30050
DEFINE BUTTON OF oBar PROMPT "Setup" RESOURCE 0x1005D BTNRIGHT

AEval( oBar:aControls, { |oBtn| oBtn:bColorMap := { |o| If( o:lMOver, { CLR_BLACK, CLR_HRED }, nil ) } } )

RETURN NIL

--------------

Image

best regards
Uwe :?:
Last edited by ukoenig on Mon May 15, 2017 9:56 am, edited 3 times in total.
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: FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Fri May 12, 2017 3:18 pm

Yes
That is not in the released version.
If you write to my email, I can send you latest version
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 17.04 : Group Labels on ButtonBars

Postby ukoenig » Fri May 12, 2017 3:26 pm

Mr. Rao,

I added a optional group using windows.
With the dialog-test I can wait until next release
because there are still many tests I want to include.

Image

thank You
regards
Uwe :D
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: FWH 17.04 : Group Labels on ButtonBars

Postby ukoenig » Fri May 12, 2017 3:51 pm

I tested the new radio-group for window-tests
The result of the bartest is ok

Image

regards
Uwe :D
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: FWH 17.04 : Group Labels on ButtonBars

Postby ukoenig » Sun May 14, 2017 4:11 pm

Mr Rao,

I tested from RESOURCE
It seems < BTNRIGHT > doesn't work.
From < CODE > it works.

Image

----------------

FUNCTION RS3_PART1() // -> Group 4 / Part 1 DIALOG from Resource
LOCAL oBar

REDEFINE BUTTONBAR oBar ID 200 OF oDlg 2013 SIZE 80,90

oBar:oGrpFont := oMedium

DEFINE BUTTON OF oBar PROMPT "Back" RESOURCE 0x100DF GROUP LABEL "Navigate" COLORS CLR_WHITE,CLR_HBLUE
DEFINE BUTTON OF oBar PROMPT "Top" RESOURCE 0x100E9
DEFINE BUTTON OF oBar PROMPT "Bottom" RESOURCE 0x100EA
DEFINE BUTTON OF oBar PROMPT "Add" RESOURCE 0x2002F GROUP LABEL "Edit" ;
COLORS CLR_WHITE, { { 1, CLR_BLACK, CLR_WHITE }, .F. }
DEFINE BUTTON OF oBar PROMPT "Edit" RESOURCE 0x20022
DEFINE BUTTON OF oBar PROMPT "Delete" RESOURCE 0x20033
DEFINE BUTTON OF oBar PROMPT "Save" RESOURCE 0x1003C GROUP LABEL "Export" COLORS CLR_WHITE,CLR_GREEN
DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE 0x30050
DEFINE BUTTON OF oBar PROMPT "Setup" RESOURCE 0x1005D ACTION oDlg:End() BTNRIGHT TOOLTIP "Exit"

AEval( oBar:aControls, { |oBtn| oBtn:bColorMap := { |o| If( o:lMOver, { CLR_BLACK, CLR_HRED }, nil ) } } )

RETURN NIL

-----------------

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: FWH 17.04 : Group Labels on ButtonBars

Postby nageswaragunupudi » Sun May 14, 2017 10:42 pm

It works in 17.05
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], karinha and 17 guests