Page 1 of 1
Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 4:08 pm
by cdmmaui
Hello,
I have two problems after upgrading to FWH
1. I have changed LISTBOX to XBROWSE and have the following problem displaying a bitmap
@210,000 XBROWSE oLbx FIELDS _ImpFlag( aHBitmaps ) , ;
import->file + IF( PA[08]='CDM-ADMIN', import->serial, '' ) , ;
...
function _ImgFlag displayed an image based on record details, however when changing to xbrowse, the image is gone and it displays numbers, how do I correct this?
Here is _ImpFlag code
FUNCTION _ImpFlag( aBitmap )
IF ( ALLTRIM( import->lastuser ) $ 'CTS EDI,CDM SYSTEM' ) .OR. ( import->commdoc = 2 ) .OR. ( EMPTY( import->mbill ) ) .OR. ( ALLTRIM( import->boxno )=='SHELL RECORD' )
RETURN ( aBitmap[02] )
ELSE
RETURN ( aBitmap[01] )
ENDIF
RETURN ( aBitMap[01] )
2. On our home screen, I would display a logo with the following code and now the logo has disappeared
ACTIVATE WINDOW oWnd ;
VALID MsgNoYes( "Do you want to Exit " + PA[04] + "?" ) ;
ON PAINT ( PalBmpDraw( hDC, (oWnd:nHeight/2-oBmp:nHeight/2)-50,(oWnd:nWidth/2-oBmp:nWidth/2), oBmp:hBitmap, oBmp:hPalette ) );
ON INIT ShowLogo( @oBmp, oWnd ) ;
MAXIMIZED
FUNCTION ShowLogo( oBmp, oWnd )
IF FILE( PA[03] + 'winfrt10.bmp' )
oBmp:LoadBMP( PA[03] + 'winfrt10.bmp' )
ENDIF
oWnd:Refresh()
SysRefresh()
RETURN (.T.)
Thank you in advance for your assistance!
Re: Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 4:32 pm
by cnavarro
Re: Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 5:37 pm
by cdmmaui
Hello,
Thank you, I tried that option in XBROWSE and it did not work.
XBROWSE code
@210,000 XBROWSE oLbx FIELDS _ImpFlag(oLbx, 1) , ;
...
FUNCTION _ImpFlag( oLbx, nCol )
local aBitmaps := {} , ;
nBitmap := 1
AADD( aBitmaps, PA[25] + "yes.bmp" )
AADD( aBitmaps, PA[25] + "no.bmp" )
DO CASE
CASE "UECANADA" $ Pmod
IF ( import->reltype = 1 )
nBitmap := 1
ELSE
nBitmap := 2
ENDIF
OTHERWISE
IF ( ALLTRIM( import->lastuser ) $ 'CTS EDI,CDM SYSTEM' ) .OR. ( import->commdoc = 2 ) .OR. ( EMPTY( import->mbill ) ) .OR. ( ALLTRIM( import->boxno )=='SHELL RECORD' )
nBitmap := 2
ELSE
nBitmap := 1
ENDIF
ENDCASE
RETURN ( oLbx:aCols[nCol]:AddBmpFile(aBitmaps[nBitmap]) )
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 1:31 am
by nageswaragunupudi
Please let us know what version you were using before upgrading.
About display of logo. There is a much simpler way. Please see this code:
Code: Select all
function Main()
local oWnd, oBmp
local cLogoBmpFile := "c:\fwh\bitmaps\fivewin.bmp" // Your bmp file name
DEFINE WINDOW oWnd
DEFINE BITMAP oBmp FILE cLogoBmpFile // does not matter even if the file does not exist
ACTIVATE WINDOW oWnd ON PAINT oWnd:DrawImage( oBmp )
oBmp:End()
return nil
I will come back to you about xbrowse, in my next post.
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 1:51 am
by nageswaragunupudi
Converting from Listbox to XBrowse:
After this code:
Code: Select all
@210,000 XBROWSE oLbx FIELDS _ImpFlag( aHBitmaps ) , ;
import->file + IF( PA[08]='CDM-ADMIN', import->serial, '' ) , ;
Please insert this code:
Code: Select all
WITH OBJECT oBrw:aCols[ 1 ]
:cDataType := "P"
:lBmpTransparent := .t.
:nDataBmpAlign := AL_CENTER
END
You will see bitmps in the first column.
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 2:27 am
by cdmmaui
Thank you! That worked!
I look forward to details regarding BMP and XBROWSE
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 2:28 am
by nageswaragunupudi
cdmmaui wrote:Thank you! That worked!
I look forward to details regarding BMP and XBROWSE
In the case of Listbox(WBrowse) a field can be either character or numeric type. All numeric fields are assumed to be bitmap handles and displayed as bitmaps.
In the case of XBrowse, any field can return a value of any type. Numbers, dates, logical, character, etc are displayed as number, dates, logical, character, etc.
If we want a number to be displayed as bitmap, we need to clealy specify that by
oCol:cDataType := "P" // "P" means picture/Image.
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 2:46 pm
by cdmmaui
Thank you Sir!
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 1:34 pm
by cdmmaui
Dear Rao,
Thanks for your help on this. However, I have one problem, at times I need to change to the image that was loaded with
DEFINE BITMAP oBmp FILENAME cBitmapFile
I tried, oBmp:LoadBMP( cLogo ), however system locks up. Can you assist? I provided code below:
//-------------------------------------
FUNCTION LoadLogo( oBmp, oWnd )
local cLogo := cDataFolder + 'winfrt10.bmp'
// New bitmap
IF FILE( cLogo )
oBmp:LoadBMP( cLogo )
ENDIF
oWnd:Refresh()
SysRefresh()
RETURN (.T.)
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 1:46 pm
by nageswaragunupudi
Please try oBmp:LoadImage( cLogo )
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 2:33 pm
by cdmmaui
Dear Rao,
That was better, however the new image is displayed on top of old image. Eventually, bitmap refreshes correctly. I have added the following code with no luck.
oBmp:Refresh()
oWnd:Refresh()
SysRefresh()
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 8:46 am
by Antonio Linares
Darrell,
Please try doing oWnd:Refresh() only
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 2:07 pm
by nageswaragunupudi
This is a working sample:
Code: Select all
#include "fivewin.ch"
function Main()
local oWnd, oBmp
local cLogoBmpFile := "c:\fwh\bitmaps\fivewin.bmp" // Your bmp file name
DEFINE WINDOW oWnd
DEFINE BITMAP oBmp FILE cLogoBmpFile // does not matter even if the file does not exist
@ 0,0 BUTTON "ChangeLogo" SIZE 80,30 PIXEL OF oWnd ;
ACTION ( oBmp:LoadImage( "c:\fwh\bitmaps\007.bmp" ), oWnd:Refresh() )
ACTIVATE WINDOW oWnd CENTERED ON PAINT oWnd:DrawImage( oBmp )
oBmp:End()
return nil
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 2:11 pm
by nageswaragunupudi
Another simpler way:
Code: Select all
#include "fivewin.ch"
function Main()
local oWnd, oBmp
local cLogoBmpFile := "c:\fwh\bitmaps\fivewin.bmp" // Your bmp file name
DEFINE WINDOW oWnd
@ 0,0 BUTTON "ChangeLogo" SIZE 80,30 PIXEL OF oWnd ;
ACTION ( cLogoBmpFile := "c:\fwh\bitmaps\007.bmp", oWnd:Refresh() )
ACTIVATE WINDOW oWnd CENTERED ON PAINT oWnd:DrawImage( cLogoBmpFile )
return nil