Hi,
How can I find out what causes palbmpread to not return an array?
Alex
Dibread/palbmpread failure
- AlexSchaft
- Posts: 172
- Joined: Fri Oct 07, 2005 1:29 pm
- Location: Edenvale, Gauteng, South Africa
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- AlexSchaft
- Posts: 172
- Joined: Fri Oct 07, 2005 1:29 pm
- Location: Edenvale, Gauteng, South Africa
palbmpread failure
Hi,
I sometimes get an array error from TBitmap():Define() method, where the hBitmap and hPalette are read from the PalBmpRead return. I slightly modified as follows:
aBmpPal = PalBmpRead( If( oWnd != nil, oWnd:GetDC(), 0 ), cBmpFile )
if isarray(aBmpPal)
::hBitmap = aBmpPal[ 1 ]
::hPalette = aBmpPal[ 2 ]
else
::hBitmap = 0
::hPalette = 0
endif
I sometimes get an array error from TBitmap():Define() method, where the hBitmap and hPalette are read from the PalBmpRead return. I slightly modified as follows:
aBmpPal = PalBmpRead( If( oWnd != nil, oWnd:GetDC(), 0 ), cBmpFile )
if isarray(aBmpPal)
::hBitmap = aBmpPal[ 1 ]
::hPalette = aBmpPal[ 2 ]
else
::hBitmap = 0
::hPalette = 0
endif
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 108
- Joined: Sun Oct 09, 2005 6:12 pm
- Location: Mar del Plata - Argentina
- Contact:
Antonio:
I confirm what alex said. Yesterday i was working in a fw 192 program recompiling it win fw 2.3 and clipper and i have some compatibility problems (i think) between dbuttons class and fw tbitmap class, so i compiled bitmap.prg from fw23\source\classes with my program and this line:
@ 18,45 BITMAP oBmp FILE "logo2.bmp" SIZE 400,100 OF oWnd NOBORDER
Produces the same error alex said:
Descripci¢n: Error BASE/1068 Error de argumento: array access
Args:
[ 1] = N 22524
Invocado por TBITMAP:LOADIMAGE(591)
The line in bitmap.prg:
aBmpPal = PalBmpRead( ::GetDC(), AllTrim( cBmpFile ) )
Is returning a numeric value instead an array, so you get an error in:
::hBitmap = aBmpPal[ 1 ]
::hPalette = aBmpPal[ 2 ]
If i put:
IF VALTYPE(ABMPPAL) # 'N'
Before those lines, the bitmap, obviously, is no painted. If you use tbitmap from fw libs you don't have any problems, seems like if the bitmap.prg in source\classes is different from the one in the libs.
Regards,
I confirm what alex said. Yesterday i was working in a fw 192 program recompiling it win fw 2.3 and clipper and i have some compatibility problems (i think) between dbuttons class and fw tbitmap class, so i compiled bitmap.prg from fw23\source\classes with my program and this line:
@ 18,45 BITMAP oBmp FILE "logo2.bmp" SIZE 400,100 OF oWnd NOBORDER
Produces the same error alex said:
Descripci¢n: Error BASE/1068 Error de argumento: array access
Args:
[ 1] = N 22524
Invocado por TBITMAP:LOADIMAGE(591)
The line in bitmap.prg:
aBmpPal = PalBmpRead( ::GetDC(), AllTrim( cBmpFile ) )
Is returning a numeric value instead an array, so you get an error in:
::hBitmap = aBmpPal[ 1 ]
::hPalette = aBmpPal[ 2 ]
If i put:
IF VALTYPE(ABMPPAL) # 'N'
Before those lines, the bitmap, obviously, is no painted. If you use tbitmap from fw libs you don't have any problems, seems like if the bitmap.prg in source\classes is different from the one in the libs.
Regards,
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: