FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with upgrade to FWH 2018 - 02
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 04:08 PM

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] )

  1. 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 04:32 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Sun Apr 15, 2018 05:37 PM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 01:31 AM
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 (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 01:51 AM
Converting from Listbox to XBrowse:

After this code:
Code (fw): Select all Collapse
@210,000 XBROWSE oLbx FIELDS _ImpFlag( aHBitmaps ) , ;
import->file + IF( PA[08]='CDM-ADMIN', import->serial, '' ) , ;


Please insert this code:
Code (fw): Select all Collapse
   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
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 02:27 AM

Thank you! That worked!

I look forward to details regarding BMP and XBROWSE

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 02:28 AM
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
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Mon Apr 16, 2018 02:46 PM

Thank you Sir!

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 01:34 PM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 01:46 PM

Please try oBmp:LoadImage( cLogo )

Regards



G. N. Rao.

Hyderabad, India
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Wed Apr 25, 2018 02:33 PM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 08:46 AM

Darrell,

Please try doing oWnd:Refresh() only

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 02:07 PM
This is a working sample:
Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem with upgrade to FWH 2018 - 02
Posted: Thu Apr 26, 2018 02:11 PM
Another simpler way:
Code (fw): Select all Collapse
#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

Continue the discussion