FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How To Display checkon.bmp
Posts: 175
Joined: Tue Nov 10, 2009 10:56 AM
How To Display checkon.bmp
Posted: Sat Feb 22, 2014 03:49 AM
Hi
Code (fw): Select all Collapse
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'


local oDlg, oBrw



function Main()



   CreateTestDBF()

   USE ABC SHARED


   select abc
   do while !eof()
      onerror("RLOCK")
      if pass = "Y"
         replace image with "checkon.bmp"
      else
         replace image with "checkoff.bmp"
      endif 
      skip 1
   enddo
   goto top


   DEFINE DIALOG oDlg FROM 0, 0 TO 31.2, 94.8 ;
   TITLE "Test" ;
   GRADIENT { { 1, nRGB( 199, 216, 237 ), nRGB( 237, 242, 248 ) } }

   @ 0,0 XBROWSE oBrw OF oDlg ;
      COLUMNS "Name", "Pass", "Image" ;
      HEADERS "Name", "Pass", "Image" ;
      SIZES 370,170 ;
      ALIAS "ABC" CELL LINES



   oBrw:nMarqueeStyle              := 1
   oBrw:nRowHeight                 := 27
   
   oBrw:aCols[ 1]:nEditType       := EDIT_BUTTON

   oCol  := oBrw:aCols[ 1 ]
   oCol:cHeader := "Name"
   oCol:nWidth := 78
   oCol  := oBrw:aCols[ 2 ]
   oCol:cHeader := "Pass"
   oCol  := oBrw:aCols[ 3 ]
   oCol:cHeader := "Image"

   oDlg:oClient      := oBrw
   oBrw:CreateFromCode()

   ACTIVATE Dialog oDlg

return nil


static function CreateTestDBF()


   DbCreate( "ABC.DBF", { { "Name", "C", 255, 0 }, { "Pass", "C", 1, 0 }, { "IMAGE", "C", 255, 0 } } )

   USE ABC EXCLUSIVE
      Append Blank
      onerror("APPEND")
      Replace Name With "John"
      Replace pass With "Y"
      Append Blank
      onerror("APPEND")
      Replace Name With "Sam"
      Replace pass With "N"

   CLOSE ABC

return nil


How to make it to display the image "checkon.bmp" and "checkoff.bmp" instead of the words "checkon.bmp" and "checkoff.bmp".

Thanks
Regards
ACWoo
Using FWH1304+harbour+bcc582
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How To Display checkon.bmp
Posted: Sat Feb 22, 2014 11:26 AM
Just working on a complete SAMPLE for download.

included NET-functions :

NET_USE ( cDBName, cAlias, nTrials, lNet )
NET_CLOSE( nTrials, nTime )
NET_RLOCK( nTrials, nTime )
NET_ULOCK()
NET_WAIT ( nTrcount, nTrials, nTime )
SHOW_WAIT( nTrcount, nTrials, nTime, oMeter, oText1 )
NET_DELETE ( nTime )
NET_RECALL ( nTime )
NET_APPEND ( nTrials, nTime )
NET_COPY ( destin, ntrials, ntime )
NET_PACK( cDBName, cAlias, nTime )


added two different copy-solutions

1. append
2. insert


Added 3 different check-solutions :

1. one C-var related to a image
2. one L-var with listbox
3. one L-var as checkbox


tested all created network-functions



best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: How To Display checkon.bmp
Posted: Sat Feb 22, 2014 01:56 PM

Acwoo

if pass = "Y"
replace image with .t.
else
replace image with .f.
endif

assuming you change the definition to IMAGE L 0

Then oBrw:oCol("image"):SetCheck( {"CHECKON.BMP", "CHECKOFF.BMP" }, .F. )

Specify the correct location for the bmps

Hth

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How To Display checkon.bmp
Posted: Sat Feb 22, 2014 02:06 PM
Richard,
I think, he doesn't want to display a checkbox.
With this solution, You can change the status of field two < Y / N > from inside field three ( image )
Code (fw): Select all Collapse
oBrw:aCols[ 3 ]:cHeader := "Image"
oBrw:aCols[ 3 ]:nHeadStrAlign := AL_CENTER
//oBrw:aCols[ 2 ]:AddResource("Checkon") // from Resource
//oBrw:aCols[ 2 ]:AddResource("Checkoff") // from Resource
oBrw:aCols[ 3 ]:addbmpfile( c_path + "Images\Checkon.bmp" ) // from Disk
oBrw:aCols[ 3 ]:addbmpfile( c_path + "Images\Checkoff.bmp" ) // from Disk
oBrw:aCols[ 3 ]:addbmpfile( c_path + "Images\Info.bmp" ) // from Disk
oBrw:aCols[ 3 ]:bBmpData := {|| IIF( ("ABC")->PASS = "Y", 1, 2 ) }
oBrw:aCols[ 3 ]:bStrData   := { || "" }
oBrw:aCols[ 3 ]:nEditType := EDIT_LISTBOX
oBrw:aCols[ 3 ]:aEditListTxt   := { "Yes", "No"}
oBrw:aCols[ 3 ]:aEditListBound := { .t., .f. }
oBrw:aCols[ 3 ]:bOnPostEdit := {|o, v| ( NET_RLOCK( 3, 3 ), ;
       IIF( v = .T., ("ABC")->PASS := "Y", ("ABC")->PASS := "N" ), ;
       NET_ULOCK() ) }
oBrw:aCols[ 3 ]:nFootBmpNo := 3 // Footer BMP
oBrw:aCols[ 3 ]:nWidth := 60


best regards
Uwe
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How To Display checkon.bmp
Posted: Sat Feb 22, 2014 09:01 PM
Download :

http://www.pflegeplus.com/fw_downloads/Xbrimg1.zip

A selection / change is related to all columns
Added dialog-background-change
Added changed / added fields LAST and FIRST for INDEX-samples



Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion