FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to use TXBrowse():bBmpData condition?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to use TXBrowse():bBmpData condition?
Posted: Sat Aug 16, 2008 07:01 PM
I try to show 'GO.BMP' in each one has '1' but it alway error. I don't know why.

Thanks,
Dutch

#include 'fivewin.ch'
#include 'xbrowse.ch'

Function Main
local oDlg, oLbx, oBtn, oSay, oGet
local aMonths := {}
local n, o, x, z, cField, nMonth, nYear, dStart, lSave, cPeriod, cOpen

for n := 1 to 12
	 aadd( aMonths , { 'Month '+str(n), ;
	 						 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ;
	 						 '1', '1', ' ', ' ', '1', ' ', ' ', ' ', ' ', ' ', ;
	 						 ' ', ' ', ' ', '1', ' ', ' ', ' ', ' ', ' ', ' ', ;
							 ' ' } )
next


   DEFINE DIALOG oDlg FROM 0, 0 TO 500,800 TITLE 'Yield Management' PIXEL


   REDEFINE XBROWSE oLbx ARRAY aMonths ;
   			COLUMNS  1,  2,  3,  4,  5,  6,  7,  8,  9, 10 ,;
   			        11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ,;
   			        21, 22, 23, 24, 25, 26, 27, 28, 29, 30 , 31, 32 ;
           	HEADERS 'Month/Year',  '1',  '2',  '3',  '4',  '5',  '6',  '7',  '8',  '9', '10', ;
					'11', '12', '13', '14', '15', '16', '17', '18', '19', '20', ;
           				'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31' ;
           	FIELDSIZES 130, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, ;
           			20, 20, 20, 20, 20, 20, 20, 20, 20, 20, ;
           			20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ;
           	OF oDlg 

// error on following lines
   for x := 2 to 32
  	oLbx:aCols[x]:AddBmpFile("GO.BMP")
  	oLbx:aCols[x]:bBmpData   := {|| iif(Eval(oLbx:aCols[x]:bStrData)='1',1,0) }
  	oLbx:aCols[x]:nDataBmpAlign := AL_CENTER
   next


   oLbx:CreateFromCode()

   oDlg:oClient := oLbx

   ACTIVATE DIALOG oDlg ON INIT oLbx:SetFocus()

return nil
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to use TXBrowse():bBmpData condition?
Posted: Sat Aug 16, 2008 07:37 PM

Dutch,

What error do you get ? Please write here the error description, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to use TXBrowse():bBmpData condition?
Posted: Sat Aug 16, 2008 07:44 PM
Dutch,

This code is working fine here:
#include 'fivewin.ch' 
#include 'xbrowse.ch' 

Function Main 
local oDlg, oLbx, oBtn, oSay, oGet 
local aMonths := {} 
local n, o, x, z, cField, nMonth, nYear, dStart, lSave, cPeriod, cOpen 

for n := 1 to 12 
    aadd( aMonths , { 'Month '+str(n), ; 
                       ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ; 
                       '1', '1', ' ', ' ', '1', ' ', ' ', ' ', ' ', ' ', ; 
                       ' ', ' ', ' ', '1', ' ', ' ', ' ', ' ', ' ', ' ', ; 
                      ' ' } ) 
next 


   DEFINE DIALOG oDlg FROM 0, 0 TO 500,800 TITLE 'Yield Management' PIXEL 


   @ 0, 0 XBROWSE oLbx ARRAY aMonths ; 
            COLUMNS  1,  2,  3,  4,  5,  6,  7,  8,  9, 10 ,; 
                    11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ,; 
                    21, 22, 23, 24, 25, 26, 27, 28, 29, 30 , 31, 32 ; 
              HEADERS 'Month/Year',  '1',  '2',  '3',  '4',  '5',  '6',  '7',  '8',  '9', '10', ; 
               '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', ; 
                       '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31' ; 
              FIELDSIZES 130, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, ; 
                    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, ; 
                    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ; 
              OF oDlg 

   for x := 2 to 32 
     oLbx:aCols[x]:AddBmpFile("GO.BMP") 
     oLbx:aCols[x]:bBmpData   := GenBlock( oLbx, x )
     oLbx:aCols[x]:nDataBmpAlign := AL_CENTER 
   next 


   oDlg:oClient := oLbx 

   ACTIVATE DIALOG oDlg ON INIT ( oLbx:SetFocus(), oDlg:ReSize() )

return nil

function GenBlock( oLbx, x )

return { || If( Eval( oLbx:aCols[ x ]:bStrData ) == '1', 1, 0 ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to use TXBrowse():bBmpData condition?
Posted: Sat Aug 16, 2008 07:47 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
How to use TXBrowse():bBmpData condition?
Posted: Sat Aug 16, 2008 07:56 PM
Mr Dutch

For this purpose or any other purpose, please never generate codeblocks within a loop using the loop index. In the above sample, value of x is 33 when the codeblock is evaluated.

While there are several ways of coding, I advise you to replace the for loop in your sample with this code:
<< your code >>
AEval( oLbx:aCols, { |oCol| SetBmpData( oCol ) }, 2  )
<< your code >>

// separate function

static function SetBmpData( oCol )

   oCol:AddBmpFile( 'GO.BMP' )
   oCol:bBmpData := { || Val( oCol:Value ) }
   
return nil
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion