xBrowse Image on inserted column

Post Reply
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

xBrowse Image on inserted column

Post by fraxzi »

Hello all!

I have this xbrowse which load the table and all fields are displayed accordingly...

I inserted below code and wanted to display the image depending on the value of :bEditValue...

Code: Select all

            ...
            oBrwPIC:InsCol( 2 ) 
            oBrwPIC:aCols[2]:bEditValue := {|e| IF(e == Nil, 1, e) }
            oBrwPIC:aCols[2]:addResource( 'checkbox16' )
            oBrwPIC:aCols[2]:addResource( 'crossbox16' )
            oBrwPIC:aCols[2]:bBmpData := {|| Eval(oBrwPIC:aCols[2]:bEditValue) }
            oBrwPIC:aCols[2]:bLDClickData := {|x| x := Eval(oBrwPIC:aCols[2]:bEditValue),;
                                                  IF( x == 1, Eval(oBrwPIC:aCols[2]:bEditValue, 2),;
                                                              Eval(oBrwPIC:aCols[2]:bEditValue, 1) ),;
                                                  oBrwPIC:RefreshCurrent() }
            ...

How can I switch :bEditValue from 1 to 2 and vice-versa by double-clicking on the column?

If the inserted column is a field, it would not be the problem... but with the inserted column, i'm in trouble. :lol:


'Appreciate any help.


Regards,
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Code: Select all

// These commands can be used even when the browse is running
// if the datasource is dbf

ADD oCol TO oBrwPIC AT 2 DATA FIELDWBLOCK( <fldname>, <nSelectArea> ) ;
HEADER 'Pic' ;
BITMAP FIELD-><fldname> IN 'checkbox16', 'crossbox16'

// If the datasource is array

ADD oCol TO oBrwPIC AT 2 ARRAY ELEM <nColNo>
HEADER 'Pic' ;
BITMAP FIELD-><fldname> IN 'checkbox16', 'crossbox16'

// if the column is inserted after the browse is already displayed and running, we need to add oBrwPIC:Refresh() after adding column


oCol:bLDClickData := { || oCol:Value := If( oCol:Value == 1, 2, 1 ), oBrwPIC:RefreshCurrent() }

Regards

G. N. Rao.
Hyderabad, India
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post by fraxzi »

Thank you for the reply NageswaraRao,

The datasource is RDD but the inserted column is kinda 'raw' but not a field... it is only to hold the value for the display of bitmap.

regards,
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post by fraxzi »

HELP! :oops:




Regards,
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

>
nserted column is kinda 'raw' but not a field.
>

What is the variable you want to be changed when the coumn is double clicked?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

As I do not what exactly is in your mind I give here an example. Column 2 is insereted. Column 2 shows bitmaps 1 by default. If user double clicks the bitmaps are toggled. You may use this logic to suit your needs.

Code: Select all

func atest

   local oWnd, oBrw, oCol
   local aNums

   use customer
   aNums := Array( LastRec() )
   AFill( aNums, 1 )

   define window ownd
   @ 0,0 xbrowse obrw ;
      columns 'Last', 'City', 'State' ;
      of ownd ;
      alias 'customer'


   oCol  := oBrw:InsCol( 2 )
   oCol:bBmpData     := { || aNums[ RecNo() ] }
   oCol:bLDClickData  := { || aNums[ RecNo() ] := If (aNums[ RecNo() ] == 1, 2, 1 ), oBrw:RefreshCurrent() }
   oCol:AddResource( 'Open' )
   oCol:AddResource( 'Close' )

   obrw:createfromcode()
   ownd:oclient := obrw

   activate window ownd

return nil
Regards

G. N. Rao.
Hyderabad, India
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post by fraxzi »

Mr. NageswaraRao,

I think this is what i'm missing... 'variable (array equal the the lenght of table) that will replace the field in xBrowse column...

...
aNums := Array( LastRec() )
AFill( aNums, 1 )
...
Clever idea. I never thought of that :roll:


Will let you know after dinner (i'm on the other side of the world ) :D
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

>
(i'm on the other side of the world )
>

I am also on the same side as you are. Just 2 1/2 hours later than you
Regards

G. N. Rao.
Hyderabad, India
User avatar
fraxzi
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines
Contact:

Post by fraxzi »

:P :P :P


It worked great :!: like magic :!:



Thank you so much and regards,
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Post Reply