Bad look btnbmp disable()
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Bad look btnbmp disable()
I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
when are disabled I see a bad btnbmp
but I think is for png file
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: Bad look btnbmp disable()
Silvio,
I cannot detect a problem,
png-images are working
--
just a question :
Because of changing the imagepath of some old posts of mine,
sometimes I cannot see the normal edit-buttons on top of the post
Sample -> I want to change :
http://www.pflegeplus.com/images/disable.png // old
to
http://www.service-fivewin.de/images/disable.png // new
maybe do You know why this happens ?
best regards
Uwe
I cannot detect a problem,
png-images are working
--
-----I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
just a question :
Because of changing the imagepath of some old posts of mine,
sometimes I cannot see the normal edit-buttons on top of the post
Sample -> I want to change :
http://www.pflegeplus.com/images/disable.png // old
to
http://www.service-fivewin.de/images/disable.png // new
maybe do You know why this happens ?
Code: Select all | Expand
@ 525, 570 BTNBMP oBtn[7] OF oDlg2 ;
SIZE 100, 45 PIXEL 2007 ; // B / H
PROMPT " &Exit " ;
ACTION oDlg2:End() ;
FONT oFont ;
LEFT
oBtn[7]:LoadBitmaps( , , c_path1 + "Exit.png" )
oBtn[7]:SetImages(c_path1 + "Exit.png")
SetTextColor( oBtn[7]:hDC, 0 )
oBtn[7]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 10526975, 16777215 }, ;
{ 0.5, 16777215, 10526975 } }, ;
{ { 0.5, 16768185 , 10526975 }, ;
{ 0.5, 10526975, 16768185 } } ) }
oBtn[7]:cToolTip = { "Exit BORDER-tests","EXIT", 1, CLR_BLACK, 14089979 }
oBtn[7]:SetColor( 0, )
@ 525, 680 BTNBMP oBtn[8] OF oDlg2 ;
SIZE 100, 45 PIXEL 2007 ; // B / H
PROMPT " &Exit " ;
ACTION oDlg2:End() ;
FONT oFont ;
LEFT
oBtn[8]:Disable() // !!!
oBtn[8]:LoadBitmaps( , , c_path1 + "Exit.png" )
oBtn[8]:SetImages(c_path1 + "Exit.png")
SetTextColor( oBtn[8]:hDC, 0 )
oBtn[8]:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 10526975, 16777215 }, ;
{ 0.5, 16777215, 10526975 } }, ;
{ { 0.5, 16768185 , 10526975 }, ;
{ 0.5, 10526975, 16768185 } } ) }
oBtn[8]:cToolTip = { "Exit BORDER-tests","EXIT", 1, CLR_BLACK, 14089979 }
oBtn[8]:SetColor( 0, )
Uwe
Last edited by ukoenig on Tue Mar 07, 2023 9:07 am, edited 1 time 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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bad look btnbmp disable()
Dear Silvio,Silvio.Falconi wrote:I have some btnbmp with pngs
when are disabled I see a bad btnbmp
but I think is for png file
How does the png file look right ? Please post it here, thanks
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Bad look btnbmp disable()
Code: Select all | Expand
#define DLG_nColorBtn1 RGB( 245,245,235)
#define DLG_nColorBtn2 RGB(250,250,245)
#define DLG_nColorBtnB RGB(195,195,185)
Function sample()
local oDlg,oBtn,oFont
local nHt := Int( ScreenHeight() * 0.2 )
local nWd := Int( ScreenWidth() * 0.2 )
local lNormal :=.f.
local nClrBorder := RGB(243,243,238)
local oChk
local oGet,cGet:= space(100)
local oSay[1]
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
RESIZABLE TiTle "test" COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX, WS_THICKFRAME )
@ 10,10 CheckBox oChk Var lNormal Prompt "check" SIZE 100,20 of oDlg ;
on change ( If(lNormal,(oBtn:Enable(), oGet:enable()),;
(oBtn:Disable(), oGet:disable())),;
oBtn:refresh(), oGet:refresh() )
@ 10, 10 BTNBMP oBtn ;
FILENAME "test.png" ;
FLAT SIZE 50,50 OF oDlg PIXEL ;
NOROUND action msginfo()
oBtn:bClrGrad = { | lInvert | If( ! lInvert,;
{ { 0.25, DLG_nColorBtn1, DLG_nColorBtn2 },;
{ 0.75, DLG_nColorBtn2, DLG_nColorBtn1 } },;
{ { 0.25, DLG_nColorBtn2, DLG_nColorBtn1 }, ;
{ 0.75, DLG_nColorBtn1, DLG_nColorBtn2 } } ) }
oBtn:nClrBorder := DLG_nColorBtnB
@ 62, 10 SAY oSay[1] PROMPT "Test Get" SIZE 100,25 PIXEL OF oDlg TRANSPARENT FONT oFont
@ 80, 10 GET oGet VAR cGet SIZE 100,24 PIXEL OF oDlg
ACTIVATE DIALOG oDlg CENTERED
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: Bad look btnbmp disable()
hi Silvo,
i have try to "disable" a BTMBMP which have a Resource
but when "disable" BTNBMP i "just" get gray Back-Ground and Caption but NO Resource (have try different)
---
BTNBMP have
as it is FROM TControl() i look there but TControl() have no Method "disable"
so i look into CLASS Window
it does nothing to grey Image
---
CLASS TBitmap have
but it is not active ...
---
there is
but it is NOT used in CLASS CODE except (Ownerdraw) MENU
so how to get a Bitmap in gray on a "disable" BTNBMP
p.s. how to change Bitmap / Color after create
i have try to "disable" a BTMBMP which have a Resource
but when "disable" BTNBMP i "just" get gray Back-Ground and Caption but NO Resource (have try different)
---
BTNBMP have
Code: Select all | Expand
METHOD Disable() INLINE ::Super:Disable(), ::Refresh()
so i look into CLASS Window
Code: Select all | Expand
METHOD Disable() INLINE ::lActive := .f.,;
If( ::hWnd != 0, EnableWindow( ::hWnd, .f. ),)
---
CLASS TBitmap have
Code: Select all | Expand
/*
METHOD Disable() INLINE ; It paints on the desktop cause hDC is not ready!
Also users may not want to see their bitmaps in gray!
DrawGray( ::GetDC(), ::hBitmap ), ::ReleaseDC(), ::Super:Disable() */
---
there is
Code: Select all | Expand
HB_FUNC( DRAWGRAY ) // ( hDC, hBitmap, nRow, nCol, nWidth, nHeight ) --> nil
{
DrawGray( ( HDC ) fw_parH( 1 ), ( HBITMAP ) fw_parH( 2 ),
hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ) );
}
so how to get a Bitmap in gray on a "disable" BTNBMP
p.s. how to change Bitmap / Color after create
greeting,
Jimmy
Jimmy
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Bad look btnbmp disable()
i made a solution but it is not good
MakeDisable_BtnBmp(oBtn)
another types
Horizontal SetBrush( "HORIZONTAL", nRGB( 0, 255, 0 ) )
Vertical SetBrush( "VERTICAL", nRGB( 20, 30, 40 ) )
FDiagonal SetBrush( "FDIAGONAL", nRGB( 255, 0, 35 ) )
BDiagonal SetBrush( "BDIAGONAL" )
Cross SetBrush( "CROSS" )
DiagCross SetBrush( "DIAGCROSS", nRGB( 0, 100, 255 ) )
then to remake the border use the Uwe's solution
DEFINE DIALOG oDlg.....
oDlg:bPainted := < |hDC|
oBtn:setsize(20,17.6) // this because the obtn is more big with png
DRAWBORDER( hDC, oBtn:nLeft-2, oBtn:ntop-2,;
oBtn:nWidth+2, oBtn:nHeight+2 , 0, 1, Rgb(195,195,185), .t. )
RETURN NIL
>
ACTIVATE DIALOG oDlg....
Result
( in my opinion it is better to see the bmp bits with diagonal lines (and it is disabled) than having a disabled btnbmp with a figure that is not nice to see )
I can make a small class to make it but I have problem with Border of Btnbmp and the last solution is that of Uwe
https://forums.fivetechsupport.com/view ... wse+border
MakeDisable_BtnBmp(oBtn)
Code: Select all | Expand
Function MakeDisable_BtnBmp(oBtn)
local aBru[ 2 ]
DEFINE BRUSH aBru[ 1 ] STYLE BDIAGONAL COLOR Rgb(195,195,185) // you can use also FDIAGONAL or another type type BORLAND OLD
DEFINE BRUSH aBru[ 2 ] STYLE BDIAGONAL COLOR Rgb(195,195,185)
oBtn:l2007:=.t.
oBtn:SetFile(,)
oBtn:lBorder := .f.
oBtn:bClrGrad := { |lInvert| If( lInvert, aBru[ 2 ]:hBrush, aBru[ 1 ]:hBrush ) }
oBtn:disable()
RETURN NIL
Horizontal SetBrush( "HORIZONTAL", nRGB( 0, 255, 0 ) )
Vertical SetBrush( "VERTICAL", nRGB( 20, 30, 40 ) )
FDiagonal SetBrush( "FDIAGONAL", nRGB( 255, 0, 35 ) )
BDiagonal SetBrush( "BDIAGONAL" )
Cross SetBrush( "CROSS" )
DiagCross SetBrush( "DIAGCROSS", nRGB( 0, 100, 255 ) )
then to remake the border use the Uwe's solution
DEFINE DIALOG oDlg.....
oDlg:bPainted := < |hDC|
oBtn:setsize(20,17.6) // this because the obtn is more big with png
DRAWBORDER( hDC, oBtn:nLeft-2, oBtn:ntop-2,;
oBtn:nWidth+2, oBtn:nHeight+2 , 0, 1, Rgb(195,195,185), .t. )
RETURN NIL
>
ACTIVATE DIALOG oDlg....
Result
( in my opinion it is better to see the bmp bits with diagonal lines (and it is disabled) than having a disabled btnbmp with a figure that is not nice to see )
I can make a small class to make it but I have problem with Border of Btnbmp and the last solution is that of Uwe
https://forums.fivetechsupport.com/view ... wse+border
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Bad look btnbmp disable()
We have this issue with some pngs.Silvio.Falconi wrote:
Code: Select all | Expand
#define DLG_nColorBtn1 RGB( 245,245,235) #define DLG_nColorBtn2 RGB(250,250,245) #define DLG_nColorBtnB RGB(195,195,185) Function sample() local oDlg,oBtn,oFont local nHt := Int( ScreenHeight() * 0.2 ) local nWd := Int( ScreenWidth() * 0.2 ) local lNormal :=.f. local nClrBorder := RGB(243,243,238) local oChk local oGet,cGet:= space(100) local oSay[1] DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14 DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL; RESIZABLE TiTle "test" COLOR CLR_BLACK, RGB( 245,245,235) ; STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ; WS_MINIMIZEBOX, WS_THICKFRAME ) @ 10,10 CheckBox oChk Var lNormal Prompt "check" SIZE 100,20 of oDlg ; on change ( If(lNormal,(oBtn:Enable(), oGet:enable()),; (oBtn:Disable(), oGet:disable())),; oBtn:refresh(), oGet:refresh() ) @ 10, 10 BTNBMP oBtn ; FILENAME "test.png" ; FLAT SIZE 50,50 OF oDlg PIXEL ; NOROUND action msginfo() oBtn:bClrGrad = { | lInvert | If( ! lInvert,; { { 0.25, DLG_nColorBtn1, DLG_nColorBtn2 },; { 0.75, DLG_nColorBtn2, DLG_nColorBtn1 } },; { { 0.25, DLG_nColorBtn2, DLG_nColorBtn1 }, ; { 0.75, DLG_nColorBtn1, DLG_nColorBtn2 } } ) } oBtn:nClrBorder := DLG_nColorBtnB @ 62, 10 SAY oSay[1] PROMPT "Test Get" SIZE 100,25 PIXEL OF oDlg TRANSPARENT FONT oFont @ 80, 10 GET oGet VAR cGet SIZE 100,24 PIXEL OF oDlg ACTIVATE DIALOG oDlg CENTERED return nil
Please try adding the clause "GDIP" while defining the BTNBMP, like this:
Code: Select all | Expand
@ 10, 10 BTNBMP oBtn ;
FILENAME "test.png" ;
FLAT SIZE 50,50 OF oDlg PIXEL GDIP ;
NOROUND action msginfo()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Bad look btnbmp disable()
surely there is a problem , you could see how to solve the border color problem of a btnbmp , because as I wrote in this post
https://forums.fivetechsupport.com/view ... ff4f02ef02
it is always black and does not change color
https://forums.fivetechsupport.com/view ... ff4f02ef02
it is always black and does not change color
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Bad look btnbmp disable()
My response was to the simple point of how does the pngs appear when the btnbmp is disabled.
I am trying to say the appearance of disabled png images differ when GDIP clause is used and not used.
This shows the difference:
When we use GDIP clause, png images on disabled buttons look like the second row.
When GDIP clause is not used, they look like the third row.
It is desirable for a programmer to know the difference.
I am trying to say the appearance of disabled png images differ when GDIP clause is used and not used.
This shows the difference:
Code: Select all | Expand
function testbtnpaint()
local oDlg, aBtn, n
local cPngPath := "..\bitmaps\pngs\"
local aPng := { cPngPath + "2.png" }
AEval( FW_ListAsArray( "1,2,6,7,8,9,10" ), { |c| ;
AAdd( aPng, cPngPath + "image" + c + ".png" ) } )
aBtn := ARRAY( 3, Len( aPng ) )
DEFINE DIALOG oDlg SIZE 80 + 70 * Len( aPng ), 430 PIXEL TRUEPIXEL ;
TITLE "BTNBMP: WITH AND WITHOUT GDIP CLAUSE"
@ 40, 40 SAY "ENABLED BUTTONS NORMAL LOOK" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 70, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL GDIP OF oDlg
next
@ 150, 40 SAY "DISABLED BUTTONS WITH GDIP clause" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 180, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL GDIP OF oDlg WHEN .F.
next
@ 260, 40 SAY "DISABLED BUTTONS WITHOUT GDIP clause" SIZE 400,12 PIXEL OF oDlg
for n := 1 to Len( aPng )
@ 290, n * 70 - 30 BTNBMP aBtn[ 1, n ] FILE aPng[ n ] SIZE 64,64 PIXEL /*GDIP*/ OF oDlg WHEN .F.
next
ACTIVATE DIALOG oDlg CENTERED
return nil
When we use GDIP clause, png images on disabled buttons look like the second row.
When GDIP clause is not used, they look like the third row.
It is desirable for a programmer to know the difference.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7104
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Bad look btnbmp disable()
THANKS i UNDERSTOOD
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com