xBrowse Image on inserted column

xBrowse Image on inserted column

Postby fraxzi » Tue Jul 29, 2008 1: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...


Code: Select all  Expand view  RUN
            ...
            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
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby nageswaragunupudi » Tue Jul 29, 2008 3:06 am

Code: Select all  Expand view  RUN
// 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
nageswaragunupudi
 
Posts: 10653
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby fraxzi » Tue Jul 29, 2008 5: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby fraxzi » Tue Jul 29, 2008 9: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10653
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » 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.

Code: Select all  Expand view  RUN
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
nageswaragunupudi
 
Posts: 10653
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby fraxzi » 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 :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
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10653
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby fraxzi » Tue Jul 29, 2008 12:04 pm

: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests