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.
oSay13:lTransparent := .T.
#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
#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
#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 )
#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
karinha wrote:Marc, In my humble opinion, that's all right, you're writing over the bar.
[code=fw]
Regards, saludos.
Antonio Linares wrote:Francisco's code is the way to do it:
viewtopic.php?p=256043&sid=5966c1a097dcce11ee22cae35e00fafa#p256043
Enrico Maria Giordano wrote:What's wrong with mine? At least it is simpler. Both codes use bPainted codeblock so they are equivalent.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 78 guests