xBrowse editing

Post Reply
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

xBrowse editing

Post 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.
Regards,
Günther
---------------------------------
office@byte-one.com
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Post 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.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Post 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")}!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: xBrowse editing

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

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

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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() 
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply