A Problem using : VTitles, Gradient / Base and BtnBmp

A Problem using : VTitles, Gradient / Base and BtnBmp

Postby ukoenig » Thu Jul 07, 2011 7:47 pm

To Daniel,

I changed a normal Button to BtnBmp inside VTitles, because it looks much better.

All Background-styles are working fine, but not using Gradient and Base.
Is it possible, to fix the Problem ? ( I would like, to keep the round Button ).
Otherwise I have to change the Button-class using Gradient-background.

oBar1:aGrdBack := { { nGradPos, nColor1, nColor2 },{ nGradPos, nColor2, nColor1 } }

Image

As soon I select a Gradient-background there is a Error ( the Button cannot detect the Gradient ) :

Image

Application
===========
Path and name: E:\T_MESSAGE\Message.exe (32 bits)
Size: 1,772,032 bytes
Time from start: 0 hours 0 mins 6 secs
Error occurred at: 07/07/11, 21:52:15
Error description: Error BASE/1004 Class: 'NIL' has no exported method: HBITMAP
Args:
[ 1] = U

Stack Calls
===========
Called from: => HBITMAP(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:PAINT(1267)
Called from: .\source\classes\BTNBMP.PRG => (b)TBTNBMP:TBTNBMP(112)
Called from: => TBTNBMP:DISPLAY(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1459)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(1450)
Called from: .\source\classes\WINDOW.PRG => _FWH(3394)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(978)
Called from: .\Message.PRG => MAIN(539)


I got it working, but no Solution of using BASE :

Image

aGrad := { { nGradPos, nColor1, nColor2 },{ nGradPos, nColor2, nColor1 } }
oBar1:aGrdBack := {}
hDC = CreateCompatibleDC( oBar1:GetDC() )
hBmp = CreateCompatibleBitMap( oBar1:hDC, oBar1:nWidth, oBar1:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oBar1:nHeight, oBar1:nWidth, aGrad )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
oBar1:ReleaseDC()
oBar1:SetBrush( oBrush )
RELEASE BRUSH oBrush


That doesn't work using BtnBmp :

oBar1:aGrdBack := { { nGradPos, nColor1, nColor2 },{ nGradPos, nColor2, nColor1 } }

oBar1:aGrdBase := { { nGradPos, nColor1, nColor2 } , ;
{ nGradPos, nColor2, nColor1 } }


Testing with BASE
doesn't crash, but not the expected Result :

Image

oBar1:lBase := .T.
aGrad := { { nGradPos, nColor1, nColor2 },{ nGradPos, nColor2, nColor1 } }
oBar1:aGrdBack := {}
hDC = CreateCompatibleDC( oBar1:GetDC() )
hBmp = CreateCompatibleBitMap( oBar1:hDC, oBar1:nWidth, oBar1:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oBar1:nHeight, oBar1:nWidth, aGrad )
oBrush := TBrush():New( ,,,, hBmp )
oBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
oBar1:ReleaseDC()
oBar1:SetBrush( oBrush )
RELEASE BRUSH oBrush


Best 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: A Problem using : VTitles, Gradient / Base and BtnBmp

Postby Daniel Garcia-Gil » Fri Jul 08, 2011 12:08 am

Hello

Please send me a sample, but the ttitle class has not designed like a parent control...
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: A Problem using : VTitles, Gradient / Base and BtnBmp

Postby ukoenig » Fri Jul 08, 2011 12:54 am

Daniel,

Thank You for the Response,
maybe to much work to find and change something inside classes.

the ttitle class has not designed like a parent control

I don't know why, but all the things I want to do, somehow I got working.

I found a Solution to change Buttons at Runtime.
Using Base, a normal Button works.

Image

Best Regards
Uwe :lol:
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: A Problem using : VTitles, Gradient / Base and BtnBmp

Postby ukoenig » Fri Jul 08, 2011 8:58 am

Found a working Solution !

Image

Code: Select all  Expand view  RUN

IF nStyle <> 8 // Button for all Styles NO Base
    @ nHeight - 55, nWidth - 50 BTNBMP oBtn OF oBar2 ;
    SIZE 40, 40 PIXEL;
    NOBORDER ;
    PROMPT "&OK" ;
    FILENAME c_path + "\Bitmaps\" + cTButton ;
    ACTION MsgAlert( "
Exit-action", "Attention !" ) ;  
    FONT oSysFont1 ;
    CENTER
    oBtn:lTransparent := .t.  
    oBtn:cToolTip =  { "
Close " + CRLF + "Message","Message End", ;
                                1, CLR_BLACK, 14089979 }
    oBtn:SetColor( 0, )
ELSE // only BASE
    @  nHeight - 37, nWidth - 36 TITLETEXT OF oBar2 ;
         TEXT "
OK"  FONT oSysFont1 COLOR 0
    @ nHeight - 52, nWidth - 52 TITLEIMG oBtn OF oBar2 ;
    BITMAP c_Path + "
\Bitmaps\" + cTButton SIZE 48, 48 ANIMA LEVEL 255 ;
    ACTION  MsgAlert( "
Exit-action", "Attention !" )
ENDIF


Best Regards
Uwe :lol:
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests