Problem with upgrade to FWH 2018 - 02

Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Sun Apr 15, 2018 4: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] )

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
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby cnavarro » Sun Apr 15, 2018 4: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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Sun Apr 15, 2018 5: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Mon Apr 16, 2018 1: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: Select all  Expand view
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: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Mon Apr 16, 2018 1:51 am

Converting from Listbox to XBrowse:

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


Please insert this code:
Code: Select all  Expand view
  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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Mon Apr 16, 2018 2: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Mon Apr 16, 2018 2: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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Mon Apr 16, 2018 2:46 pm

Thank you Sir!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Wed Apr 25, 2018 1: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Wed Apr 25, 2018 1:46 pm

Please try oBmp:LoadImage( cLogo )
Regards

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

Re: Problem with upgrade to FWH 2018 - 02

Postby cdmmaui » Wed Apr 25, 2018 2: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Problem with upgrade to FWH 2018 - 02

Postby Antonio Linares » Thu Apr 26, 2018 8:46 am

Darrell,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Thu Apr 26, 2018 2:07 pm

This is a working sample:
Code: Select all  Expand view
#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: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with upgrade to FWH 2018 - 02

Postby nageswaragunupudi » Thu Apr 26, 2018 2:11 pm

Another simpler way:
Code: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 99 guests