REDEFINE SAY on Buttonbar

User avatar
TimStone
Posts: 2951
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

REDEFINE SAY on Buttonbar

Post by TimStone »

I have a buttonbar. On the right side, I want to display text. To do this, I must redefine a SAY ( text ) control.

REDEFINE SAY oSay13 PROMPT cVIN ID 4001 OF oWdlg1 FONT oXLfont

Yes, it works.

Here is my problem. The BUTTONBAR has a gradient background. It looks nice. Unfortunately, the SAY displays in a box with a different background.
What I actually want is for just the lettering to display on the gradient background of the buttonbar, and not have a field showing.

Suggestions ? Yes, it works, but it doesn't look good.
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
cnavarro
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: REDEFINE SAY on Buttonbar

Post by cnavarro »

TimStone wrote:I have a buttonbar. On the right side, I want to display text. To do this, I must redefine a SAY ( text ) control.

REDEFINE SAY oSay13 PROMPT cVIN ID 4001 OF oWdlg1 FONT oXLfont

Yes, it works.

Here is my problem. The BUTTONBAR has a gradient background. It looks nice. Unfortunately, the SAY displays in a box with a different background.
What I actually want is for just the lettering to display on the gradient background of the buttonbar, and not have a field showing.

Suggestions ? Yes, it works, but it doesn't look good.
Try with

Code: Select all | Expand

   oSay13:lTransparent   := .T.
 
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
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Enrico Maria Giordano »

We need a reduced sample showing the problem that can be compiled and run.
User avatar
Marc Venken
Posts: 1481
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: REDEFINE SAY on Buttonbar

Post by Marc Venken »

I have almost the same issue. In my case it seems to be with buttonbar in xbrowse and ribbonbar.

Here I tried a sample ... (for the xbrowse version) The picture shows ribbonbar and this sample.

Transparent does not do it.

In the pic of browse, you see 'STATES'. That is correct view, but this is from insite the class xbrowse

Code: Select all | Expand

#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oFont, oBrw

   USE CUSTOMER NEW SHARED VIA "DBFCDX"
   USE STATES   NEW SHARED VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 600,470 PIXEL TRUEPIXEL RESIZABLE FONT oFont ;
      TITLE "XBROWSE : BUILT-IN BUTTON BAR"

   @  20,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END

   @ 250,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function XbrSetupBar( oBrw )
   local oSay13

   oBrw:nTopBarHeight := 30
   oBrw:bOnAdjust := <||
      local oBtn
      @ 05,05 BTNBMP oBtn FILE "..\bitmaps\16X16\new.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource( .t. ) TOOLTIP "Add New Record"
      @ 05,45 BTNBMP oBtn FILE "..\bitmaps\edit.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource() TOOLTIP "Edit this record"
      @ 05,85 BTNBMP oBtn FILE "..\bitmaps\16x16\delete.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION If( MsgNoYes( "Delete this row?" ),,oBrw:Delete() ) TOOLTIP "Delete This Record"
      @ 05,300 SAY oSay13 var "Test" SIZE 50, 20 PIXEL OF oBrw TRANSPARENT UPDATE
      oSay13:lTransparent   := .T.

      return nil
      >

return nil

 
Image
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Enrico Maria Giordano »

This is a workaround:

Code: Select all | Expand

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT MKBUTTONBAR( oDlg );
             CENTER

    RETURN NIL


STATIC FUNCTION MKBUTTONBAR( oDlg )

    DEFINE BUTTONBAR OF oDlg 3D 2007

    oDlg:oBar:bPainted = { || oDlg:oBar:Say( 5, 200, "Test", , , , .T., .T. ) }

    RETURN NIL
User avatar
FranciscoA
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: REDEFINE SAY on Buttonbar

Post by FranciscoA »

Here other way.

Code: Select all | Expand

#include "FiveWin.ch"

Static oWnd

Function Main()
   local oBar, oFont1

   DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-14 BOLD

   DEFINE WINDOW oWnd MDI;
      FROM 0, 0 TO 24.8, 80 ;
      TITLE "TEST"

   DEFINE BUTTONBAR oBar 3D SIZE 40,40 OF oWnd 2007
   oBar:bPainted = { ||;
        DrawText2(oBar:hDC, oFont1:hFont, 1, "THIS IS A TEXT ON BUTTONBAR" ,;
        10, 420, 500, 500, CLR_BLACK ) }

   ACTIVATE WINDOW oWnd MAXIMIZED 

   RELEASE oFont1

RETURN( NIL )

FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight,color )     //<---- I took this code, from the forum
   LOCAL hFontOld:= SelectObject( hDC, hFont )
   LOCAL nBkOld := SetBkMode( hDC, nBkMode )
   SetTextColor( hDC, color )
   DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
   SelectObject( hDC, hFontOld )
   SetBkMode( hDC, nBkOld )
RETURN( NIL )
 
Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: REDEFINE SAY on Buttonbar

Post by karinha »

Marc, In my humble opinion, that's all right, you're writing over the bar.

Code: Select all | Expand

#include "fivewin.ch"

#define COLOR_BTNFACE       15

REQUEST DBFCDX

function Main()

   local oDlg, oFont, oBrw, oSay13

   USE CUSTOMER NEW SHARED VIA "DBFCDX"
   USE STATES   NEW SHARED VIA "DBFCDX"

   SkinButtons()

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

   DEFINE DIALOG oDlg SIZE 600,470 PIXEL TRUEPIXEL RESIZABLE FONT oFont ;
      TITLE "XBROWSE : BUILT-IN BUTTON BAR"

   @  20,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END

   @ 250,20 XBROWSE oBrw SIZE -20,200 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER

   XbrSetupBar( oBrw )

   WITH OBJECT oBrw

      oBrw:l2007 := .F.

      :nEditTypes    := EDIT_GET
      :SetChecks()
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil

function XbrSetupBar( oBrw )

   local oSay13

   oBrw:nTopBarHeight := 30
   oBrw:bOnAdjust := <||
      local oBtn

      @ 05,05 BTNBMP oBtn FILE "..\bitmaps\16X16\new.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource( .t. ) TOOLTIP "Add New Record"

      @ 05,45 BTNBMP oBtn FILE "..\bitmaps\edit.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION oBrw:EditSource() TOOLTIP "Edit this record"

      @ 05,85 BTNBMP oBtn FILE "..\bitmaps\16x16\delete.bmp" SIZE 30,20 PIXEL OF oBrw NOBORDER ;
        ACTION If( MsgNoYes( "Delete this row?" ),,oBrw:Delete() ) TOOLTIP "Delete This Record"

      @ 05,300 SAY oSay13 var "Test SAY" SIZE 065, 20 PIXEL OF oBrw ;
         UPDATE TRANSPARENT

      oSay13:SetColor( CLR_BLACK, GetSysColor( COLOR_BTNFACE ) )

      oBrw:bClrGrad = {| lInvert | If( lInvert, ;
         { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
         { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
         },                                                         ;
         { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
         { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
         } ) }

      return nil
      >

return nil
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
TimStone
Posts: 2951
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: REDEFINE SAY on Buttonbar

Post by TimStone »

The SAY has a variable which changes depending on a status of what data is being displayed. That is why it is used.

The word "Test" in one of Marc's screen shots is exactly what I'm explaining.

Transparent does not resolve the problem.

My concern with the Paint options is that the display will change while working on the data. So I have a Dialogs of fields, and a browse. One button changes a "filter" status on the database, and the words displayed on the button bar indicate which filter is used.

I appreciate the desire for a sample to test, but the issue here is how to display a variable text on top of a buttonbar without showing a background. Also, I am using this with resources ( .rc ), and the control to use is for the SAY method.
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
Marc Venken
Posts: 1481
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: REDEFINE SAY on Buttonbar

Post by Marc Venken »

karinha wrote:Marc, In my humble opinion, that's all right, you're writing over the bar.

Code: Select all | Expand

Regards, saludos.[/quote]

Hey,

But with this sample, also the buttons seems not to be ok.  Maybe I miss understood your idea or the point you would like to make ?

[img]https://maveco.be/fivewin/browse.jpg[/img]
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
Antonio Linares
Site Admin
Posts: 42273
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Antonio Linares »

Francisco's code is the way to do it:

http://fivetechsupport.com/forums/viewt ... fa#p256043
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Enrico Maria Giordano »

What's wrong with mine? At least it is simpler. Both codes use bPainted codeblock so they are equivalent.
User avatar
Marc Venken
Posts: 1481
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: REDEFINE SAY on Buttonbar

Post by Marc Venken »

Antonio Linares wrote:Francisco's code is the way to do it:

http://fivetechsupport.com/forums/viewt ... fa#p256043
Correct, but it is always interesting why some of us do things.

Antonio, I wonder ..... Is this a temporary workaround or something that is going to change in next version ? Seemse strange that it takes extra lines of code in putting a transparent say on a dialog while other items are transparent.
I looked into the xbrowse code, but that is high level programming... Not for me )))) and I don't change originale FW-code for updates.

Thanks...
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
Marc Venken
Posts: 1481
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: REDEFINE SAY on Buttonbar

Post by Marc Venken »

Enrico Maria Giordano wrote:What's wrong with mine? At least it is simpler. Both codes use bPainted codeblock so they are equivalent.
It is working indeed... But I wonder why bPainted is needed ? What does it do ?
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Enrico Maria Giordano »

bPainted is executed when the control (the buttonbar in this case) needs to be repainted.
User avatar
Antonio Linares
Site Admin
Posts: 42273
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: REDEFINE SAY on Buttonbar

Post by Antonio Linares »

ops, Enrico, I missed your solution that was posted earlier :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply