Changing the edit picture on the same col (xbrowse)

Changing the edit picture on the same col (xbrowse)

Postby Marco Turco » Thu May 07, 2009 1:49 pm

Hi all,
another xbrowse issue.

I have an array with the second element (aarray[x,2]) numeric editable.
I would like to use the picture "99.9" for the value on the first row and "99.99" for the value on the second row.

Any suggest how can I make this ?

Thanks in adance

This self-contained sample show my problem.

function Main()

local oDlg, oBrw, aArray

set epoch to 1920

aArray:={}
aadd(aArray,{"Marc",10.2}) && I have a one digit value
aadd(aArray,{"Luca",6.55}) && I have a two digit value

DEFINE DIALOG oDlg SIZE 300, 200

@0,0 XBROWSE oBrw OF oDlg ARRAY aArray AUTOCOLS

oBrw:aCols[2]:cEditPicture := "@E 999.99" && <-------- ? ?
oBrw:aCols[2]:nEditType := 1
oBrw:aCols[2]:bOnPostEdit := {|o,x| nLastCell:=oBrw:nArrayAt,aArray[oBrw:nArrayAt,2]:=x}
oBrw:lFastEdit:=.t.
oBrw:CreateFromCode()

ACTIVATE DIALOG oDlg CENTER

return nil
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Changing the edit picture on the same col (xbrowse)

Postby nageswaragunupudi » Thu May 07, 2009 11:01 pm

Please try this revised sample
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

local oDlg, oBrw, aArray
local nLastCell

* set century off
set epoch to 1920

aArray:={}
aadd(aArray,{"Marc",1.2})
aadd(aArray,{"Luca",6.5})
aadd(aArray,{"James",11.3})
aadd(aArray,{"Christine",1.3})
aadd(aArray,{"Melanie",15.3})
aadd(aArray,{"Robert",14.3})
aadd(aArray,{"Jimmy",13.3})
aadd(aArray,{"Enrico",10.3})
aadd(aArray,{"Mario",12.3})
aadd(aArray,{"Pinco",13.3})
aadd(aArray,{"Eric",14.3})


XbrNumFormat( 'E', .t. )   // Set numbers to European format

DEFINE DIALOG oDlg SIZE 300, 200

@0,0 XBROWSE oBrw OF oDlg ARRAY aArray AUTOCOLS ;


oBrw:aCols[2]:cEditPicture := "999.9"
oBrw:aCols[2]:nEditType := 1
oBrw:aCols[2]:bOnPostEdit := {|o,x| nLastCell:=oBrw:nArrayAt,aArray[oBrw:nArrayAt,2]:=x}

oBrw:aCols[2]:bEditValue := { || oBrw:aRow[ 2] }
oBrw:aCols[2]:bStrData := ;
   { || cValToStr( oBrw:aRow[2], If( oBrw:nArrayAt == 1, ;
        '999.9', '999.99' ) ) }


oBrw:lFastEdit:=.t.
oBrw:bPastEof  := { || If( ATail( aArray )[2] != 0, (AAdd( aArray, { 'New', 0 } ), oBrw:Refresh()), ) }
oBrw:CreateFromCode()
oBrw:bChange := { | oBrw | oBrw:aCols[2]:cEditPicture := If( oBrw:nArrayAt == 1, ;
                           '999.9', '999.99' ) }

ACTIVATE DIALOG oDlg CENTER

return nil
 
Last edited by nageswaragunupudi on Fri May 08, 2009 11:16 am, edited 1 time in total.
Regards

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

Re: Changing the edit picture on the same col (xbrowse)

Postby Marco Turco » Fri May 08, 2009 6:59 am

Hi,
the numeric cells are diplayed well
but I need to make the same with the edit picture also.

Something like this:
oBrw:aCols[2]:bEditPicture := ;
{ || cValToStr( oBrw:aRow[2], If( oBrw:nArrayAt == 1, ;
'999.9', '999.99' ) ) }

But the bEditPicture doesn't exist.
Is there a codeblock that can we use to make this ?

Thanks in advance.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Changing the edit picture on the same col (xbrowse)

Postby nageswaragunupudi » Fri May 08, 2009 11:20 am

I am sorry. I made a mistake in copying the code. I now edited it.
We can change the edit picture through bChange
here is the right code
Code: Select all  Expand view
oBrw:bChange := { | oBrw | oBrw:aCols[2]:cEditPicture := If( oBrw:nArrayAt == 1, ;
                           '999.9', '999.99' ) }
 

Please compile the ( now edited ) source in my previous post and see both display and edit picture are working properly.
At of now XBrowse does not support code block for edit picture, but we can achieve what you want as in the example above.
Regards

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

Re: Changing the edit picture on the same col (xbrowse)

Postby Marco Turco » Fri May 08, 2009 5:18 pm

It runs fine. Thank you very much for your support.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 114 guests