gpf error strange

gpf error strange

Postby Silvio » Thu Apr 02, 2009 8:01 am

I want create a simply dialog with gradientbrush and group control and a bitmap over it
it make a strange gpf

I use xp professional sp3

Code: Select all  Expand view


#include "FiveWin.ch"

Function test()
   Local oDlg,oGroup,oBmp1

DEFINE DIALOG oDlg From 10, 4 to 28,70 TiTle "test"

  @ 0,0.7 GROUP oGroup TO 3.8,30.5 PROMPT "test of the test" OF oDlg  COLOR CLR_YELLOW, CLR_BLUE
    oGroup:ltransparent:=.T.

 @ 1,28  BITMAP oBmp1 FILENAME "OmbrG.BMP"  NOBORDER   SIZE 100,50
 oBmp1:ltransparent:=.T.

ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT GradientBrush( oDlg, { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } } )
return nil


function GradientBrush( oDlg, aColors )

   local hDC, hBmp, hBmpOld
   
   if Empty( oDlg:oBrush:hBitmap )
      hDC = CreateCompatibleDC( oDlg:GetDC() )
      hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
      hBmpOld = SelectObject( hDC, hBmp )
      GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors )
      oDlg:oBrush:hBitmap = hBmp
      oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
      SelectObject( hDC, hBmpOld )
      oDlg:ReleaseDC()
   endif  

   return nil

   DLL32 FUNCTION CreateCompatibleBitmap( hDC AS LONG, nWidth AS LONG, nHeight AS LONG ) AS LONG ;
      PASCAL FROM "CreateCompatibleBitmap" LIB "gdi32.dll"
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: gpf error strange

Postby ukoenig » Thu Apr 02, 2009 3:53 pm

Hello Silvio,

what You need works fine, but my code is different.

Image

Code: Select all  Expand view

// ---------------------------

FUNCTION PRICE_DAYS(oWnd)
LOCAL oBtn1, oBtn2, oGET, oGET1, oGET2, oGET3, oGroup, oBmp1

DEFINE DIALOG oDlg SIZE 300, 270 TITLE "Price Test" TRANSPARENT

@ 2.6, 1.5 GROUP oGroup TO  6.5, 20 PROMPT "Calculation" OF oDlg  COLOR CLR_YELLOW, CLR_BLUE
oGroup:ltransparent:=.T.

@ 3.2, 3 SAY oSay PROMPT "Price = .T. only used for Price-calculation"

@ 4, 5 SAY oSay PROMPT "Start"
@ 4, 13 SAY oSay PROMPT "End"
@ 4, 19 SAY oSay PROMPT "Price ?"

@ 5.5, 2  GET oGet1 VAR dDAY1 OF oDlg SIZE 40, 15  PICTURE "##.##.####"
@ 5.5, 8  GET oGet2 VAR dDAY2 OF oDlg SIZE 40, 15  PICTURE "##.##.####"
@ 5.5, 16  CHECKBOX oGet3 VAR lPRICE PROMPT "&Price" SIZE 100, 20 OF oDlg

@ 5.5, 1.9 BUTTON oBtn1 PROMPT "Date-Test" size 50, 25 OF oDlg ;
ACTION ( oGet1:Refresh(), oGet2:Refresh(), oGet3:Refresh(), ;
                 GET_DAYS( dDAY1, dDAY2, aSEASON ) )

@ 5.5, 15 BUTTON oBtn2 PROMPT "Close" size 50, 25 OF oDlg ;
ACTION ( oDlg:End() )

ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT gradpaint1( hDC, oDlg )  

RETURN ( NIL )

// -----------------------------------------------

static func gradpaint1( hDC, oDlg )
Local oBmp1
local aGrad := { { 0.50, 16054371, 11892819 } }

GradientFill( hDC,  0, 0, oDlg:nHeight, oDlg:nWidth, aGrad, .F. )

DEFINE BITMAP oBmp1 FILENAME "User.bmp"
ABPaint( hDC, 20, 10, oBmp1:hBitmap, 220 )

RETURN NIL
 


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: gpf error strange

Postby Silvio » Thu Apr 02, 2009 3:59 pm

try to insert trasparent bimap into group
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: gpf error strange

Postby ukoenig » Thu Apr 02, 2009 4:11 pm

Works fine :

Image

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: gpf error strange

Postby Silvio » Fri Apr 03, 2009 8:00 am

can see you code pls into a dialog NO gradient
no use gradpaint function
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: gpf error strange

Postby ukoenig » Fri Apr 03, 2009 1:25 pm

Hello Silvio,

I noticed, that You do the BMP-Painting together with the Gradient ON INIT.
Did You try Gradient and BMP-display with ON PAINT ?
I didn't test Your code for the moment.

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: Google [Bot] and 91 guests