xbrowse check and unckeck

Post Reply
Wanderson
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

xbrowse check and unckeck

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: xbrowse check and unckeck

Post by Antonio Linares »

Here you have an example:

Code: Select all

   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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Wanderson
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: xbrowse check and unckeck

Post by Wanderson »

Antonio Linares wrote:Here you have an example:

Code: Select all

   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
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: xbrowse check and unckeck

Post by karinha »

Code: Select all

   // Testxbrw.prg y testxbrw.rc
   oCol:SetCheck( { "GREEN", "RED" }, {|o, v| (DBRLOCK(), _FIELD->Married := v, DBUNLOCK() ) } )
 
João Santos - São Paulo - Brasil
Francisco Horta
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Re: xbrowse check and unckeck

Post 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
____________________
Paco
Post Reply