How To Display checkon.bmp

Post Reply
acwoo1
Posts: 159
Joined: Tue Nov 10, 2009 10:56 am

How To Display checkon.bmp

Post by acwoo1 »

Hi

Code: Select all

#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
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How To Display checkon.bmp

Post 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:
Last edited by ukoenig on Sat Feb 22, 2014 4:33 pm, edited 12 times in total.
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.
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: How To Display checkon.bmp

Post 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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How To Display checkon.bmp

Post 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

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.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: How To Display checkon.bmp

Post 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:
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.
Post Reply