Page 1 of 1

xbrowse check and unckeck

PostPosted: Tue May 26, 2015 2:42 pm
by Wanderson
Hi

I have a xbrowse with an empty array at any given time will fill this array with data and the first column to 0 for unchecked record. How to set this column with bitmap check and unckeck when clicked?

Thanks.

Re: xbrowse check and unckeck

PostPosted: Tue May 26, 2015 5:42 pm
by Antonio Linares
Here you have an example:

Code: Select all  Expand view
  WITH OBJECT oBrw:InsCol( 1 )
      :cHeader    := "Selected"
      :SetCheck( { "blackdot", nil }, .t. )
      :bKeyChar   := { |k| If( k == 32, ( oBrw:oCol( 1 ):CheckToggle(), 0 ), nil ) }
   END


But I think that it should use a logical value instead of a zero

Re: xbrowse check and unckeck

PostPosted: Tue May 26, 2015 5:52 pm
by Wanderson
Antonio Linares wrote:Here you have an example:

Code: Select all  Expand view
  WITH OBJECT oBrw:InsCol( 1 )
      :cHeader    := "Selected"
      :SetCheck( { "blackdot", nil }, .t. )
      :bKeyChar   := { |k| If( k == 32, ( oBrw:oCol( 1 ):CheckToggle(), 0 ), nil ) }
   END


But I think that it should use a logical value instead of a zero


Hi thank you Antonio,

I use xbrowse with resource please tell me how i do in this case:

oCol := oBrwc:AddCol()
oCol:AddResource( "UNCHECK" )
oCol:AddResource( "CHECK" )
oCol:SetCheck( { "CHECK", nil }, .t. )
oCol:lBmpStretch := .f.
oCol:lBmpTransparent := .t.
oCol:nHeadStrAlign := oCol:nDataBmpAlign := AL_CENTER
oCol:cHeader := ""
oCol:nWidth := 18
oCol:nArrayCol := 1

Re: xbrowse check and unckeck

PostPosted: Tue May 26, 2015 6:42 pm
by karinha
Code: Select all  Expand view

   // Testxbrw.prg y testxbrw.rc
   oCol:SetCheck( { "GREEN", "RED" }, {|o, v| (DBRLOCK(), _FIELD->Married := v, DBUNLOCK() ) } )
 



Re: xbrowse check and unckeck

PostPosted: Tue May 26, 2015 9:22 pm
by Francisco Horta
Wanderson,

myarray := { { 1, .t., "Hello" }, {2, .f., "World" } }

oBrw:aCols[2]:AddBmpHandle( "Chk_T" )
oBrw:aCols[2]:AddBmpHandle( "Chk_F" )
oCol:bBmpData := {|| IF( myArray[ oBrw:nArrayAt, 2], 1, 2) }
oCol:bStrData := { || Nil }

Regards
Paco