FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Image on inserted column
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 01:33 AM
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...


            ...
            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. :-)


'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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 03:06 AM
// 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
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 05:27 AM

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
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 09:18 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 11:17 AM

>
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 11:22 AM
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.

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
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 11:35 AM
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 :-)


Will let you know after dinner (i'm on the other side of the world ) :-)
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 11:47 AM

>
(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
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
xBrowse Image on inserted column
Posted: Tue Jul 29, 2008 12:04 PM

It worked great :!: like magic :!:

Thank you so much and regards,

:P:P:P

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

Continue the discussion