FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse editing
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
xBrowse editing
Posted: Fri Jan 18, 2008 11:08 PM

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.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
xBrowse editing
Posted: Sat Jan 19, 2008 12:37 AM

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

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowse editing
Posted: Sat Jan 19, 2008 06:13 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
xBrowse editing
Posted: Sat Jan 19, 2008 09:18 AM
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.
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowse editing
Posted: Sat Jan 19, 2008 07:15 PM

Günther,

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

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
xBrowse editing
Posted: Sun Jan 20, 2008 11:11 AM
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")}!
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBrowse editing
Posted: Sun Jan 20, 2008 02:09 PM
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:
     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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowse editing
Posted: Sun Jan 20, 2008 05:10 PM

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.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse editing
Posted: Tue Jan 22, 2008 07:43 AM
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
   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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
xBrowse editing
Posted: Tue Jan 22, 2008 09:46 AM

Is tjhere a function to edit a record in vertical as th eold tedit of Super35 lib ?

Best Regards, Saludos



Falconi Silvio
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xBrowse editing
Posted: Tue Jan 22, 2008 10:05 AM
Silvio,

We implemented it in FiveMac using this code:
METHOD SetEdit() CLASS TWBrowse

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

   ::Refresh()

return nil

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

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

Antonio Linares
www.fivetechsoft.com

Continue the discussion