FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Changing the edit picture on the same col (xbrowse)
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Changing the edit picture on the same col (xbrowse)
Posted: Thu May 07, 2009 01: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Changing the edit picture on the same col (xbrowse)
Posted: Thu May 07, 2009 11:01 PM
Please try this revised sample
Code (fw): Select all Collapse
#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
Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Changing the edit picture on the same col (xbrowse)
Posted: Fri May 08, 2009 06: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Changing the edit picture on the same col (xbrowse)
Posted: 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 (fw): Select all Collapse
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
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Changing the edit picture on the same col (xbrowse)
Posted: Fri May 08, 2009 05:18 PM

It runs fine. Thank you very much for your support.

Best Regards,



Marco Turco

SOFTWARE XP LLP

Continue the discussion