Page 1 of 1

xBrowse editing

Posted: Fri Jan 18, 2008 11:08 pm
by byte-one
Hello,
is there a way for xBrowse to edit one column in an row and in another row editing from the same column is not allowed? There is no bWhen or so!?
Any ideas?
Also the picture z.B. "@E ##.#" from numeric data only in editing-mode is active. In normal mode this picture is not active.

Posted: Sat Jan 19, 2008 12:37 am
by ShumingWang
Change xbrowse.prg xbrwocol :nEditType data into data block type
Change
if oCol:nEditType>0
into if(VALTYPE(oCol:nEditType)=="B",EVAL(oCol:nEditType),VAL(cvaltochar(oCol:nEditType))) > 0

Then your prg ocol:nedittype:={||mycondition()}


Shuming Wang

Posted: Sat Jan 19, 2008 6:13 am
by Antonio Linares
Günther,

Instead of modifying the class, you can use <oBrowse>:bChanged to change the edit style based on some conditions:

http://fivetechsoft.com/forums/viewtopic.php?t=9576

Posted: Sat Jan 19, 2008 9:18 am
by byte-one
Thanks, both ways are possible!

For the second problem I wrote is no solution?

Also the picture z.B. "@E ##.#" from numeric data only in editing-mode is active. In normal mode this picture is not active.

Posted: Sat Jan 19, 2008 7:15 pm
by Antonio Linares
Günther,

> the picture z.B. "@E ##.#"

Have you tried it using Transform() ? Does Transform() properly use it ?

Posted: Sun Jan 20, 2008 11:11 am
by byte-one
Can I use to show the numeric value in the xBrowse transform(value,"picture") and the returned value transfer with val() return to numeric?
Also I found, that the oBrw:bChange with keybord are ok, with the mouse it is evaluated when I change the row and change the cell always twice! Please try oBrw:bChange := {||msginfo("change")}!

Posted: Sun Jan 20, 2008 2:09 pm
by nageswaragunupudi
1) The codeblock bChange is evaluated twice in the LButtonDown method. Lines 2202 to 2204 ( source 8.01 ) can be removed or commented out.

2) Also bChange is evaluated even if the mouse click does not result in change of row. It would be nice if bChange is evaluated only if the row has changed. This can be implemented in many ways, but one suggested method ( using already declared locals ) is to replace lines 2177 to 2187 as below:

Code: Select all

     nTmp := 0 
     if nRowPos > 0
         Eval( ::bSkip, nTmp := ( nRowPos - ::nRowSel ) )
         ::nRowSel := nRowPos
      endif
      if nColPos > 0
         ::nColSel := nColPos
      endif

       if nTmp != 0 .and. ::bChange != nil
          Eval( ::bChange, Self )
       endif
This fix works till release of the fix by FWH in the next version.

Posted: Sun Jan 20, 2008 5:10 pm
by Antonio Linares
Günther,

We are actually out of our offices until next tuesday.

Please follow Nageswararao advise. We will review it as soon as we are back next tuesday.

Re: xBrowse editing

Posted: Tue Jan 22, 2008 7:43 am
by nageswaragunupudi
byte-one wrote:Hello,
is there a way for xBrowse to edit one column in an row and in another row editing from the same column is not allowed? There is no bWhen or so!?
Any ideas?
I too feel the need for bWhen block. We may decide if the column is to be edited or not depending on the other values. We can not always manage it with bChange. I too join to request Mr Antonio to provide bWhen for edits.
the picture z.B. "@E ##.#"
In my tests I found that the picture clause is working in both edits and normal display.
This is my test code

Code: Select all

   oCol:cHeader      := "Value"
   oCol:bStrData     := { || Transform( aData[ oBrw:nArrayAt ][ 2 ], cPic ) }
   oCol:bEditValue   := { || aData[ oBrw:nArrayAt ][ 2 ] }
   oCol:cEditPicture := cPic
   oCol:nEditType    := 1
   oCol:bOnPostEdit  := { | oCol, nVal, nKey | if( nKey == 13, aData[ oBrw:nArrayAt ][ 2] := nVal,  ) }
   oCol:nDataStrAlign := oCol:nHeadStrAlign := AL_RIGHT
I am using FWH 8.01, xHarbour 1.1.0, bcc55.

Posted: Tue Jan 22, 2008 9:46 am
by Silvio
Is tjhere a function to edit a record in vertical as th eold tedit of Super35 lib ?

Posted: Tue Jan 22, 2008 10:05 am
by Antonio Linares
Silvio,

We implemented it in FiveMac using this code:

Code: Select all

METHOD SetEdit() CLASS TWBrowse

   ::bLogicLen = { || RecCount() * ( FCount() + 1 ) }
   ::cAlias = "_EDIT"

   ::Refresh()

return nil    

Code: Select all

   do case
         case ::cAlias == "_EDIT"
	         DbGoTop()
	         DbSkip( Int( nRow / ( FCount() + 1 ) ) )
		 nField = ( nRow + 1 ) % ( FCount() + 1 )
                 return If( nField == 0, If( nCol == 0, "-------------", "-------------------------------------" ),;
		           If( nCol == 0, FieldName( nField ), cValToChar( FieldGet( nField ) ) ) )  

Code: Select all

   @ 48, 20 LISTBOX oBrw FIELDS "", "" HEADERS "FieldName", "Value" ;
      OF oWnd SIZE 672, 363 ALIAS Alias()