Problem with upgrade to FWH 2018 - 02

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Problem with upgrade to FWH 2018 - 02

Post 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!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with upgrade to FWH 2018 - 02

Post by cnavarro »

C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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]) )
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post by cdmmaui »

Thank you! That worked!

I look forward to details regarding BMP and XBROWSE
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post by cdmmaui »

Thank you Sir!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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.)
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post by nageswaragunupudi »

Please try oBmp:LoadImage( cLogo )
Regards

G. N. Rao.
Hyderabad, India
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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()
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post by Antonio Linares »

Darrell,

Please try doing oWnd:Refresh() only
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem with upgrade to FWH 2018 - 02

Post 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
 
Regards

G. N. Rao.
Hyderabad, India
Post Reply