Page 1 of 1

How To Display checkon.bmp

PostPosted: Sat Feb 22, 2014 3:49 am
by acwoo1
Hi
Code: Select all  Expand view
#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

Re: How To Display checkon.bmp

PostPosted: Sat Feb 22, 2014 11:26 am
by ukoenig
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

Image

best regards
Uwe :lol:

Re: How To Display checkon.bmp

PostPosted: Sat Feb 22, 2014 1:56 pm
by Richard Chidiak
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

Re: How To Display checkon.bmp

PostPosted: Sat Feb 22, 2014 2:06 pm
by ukoenig
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: Select all  Expand view

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

Re: How To Display checkon.bmp

PostPosted: Sat Feb 22, 2014 9:01 pm
by ukoenig
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

Image

Best regards
Uwe :lol: