XBrowse online editing
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
XBrowse online editing
Detlef,
We are intensively testing fwh\samples\mallorca.prg to fix it.
We have already located and fixed some issues:
1. Class TXBrowse Method CancelEdit(). This line should be removed:
// oCol:oEditGet:nLastKey := VK_RETURN
2. In mallorca.prg change this lines:
oBrw:aCols[1]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,1] := xVal,) }
oBrw:aCols[2]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,2] := xVal,) }
We are intensively testing fwh\samples\mallorca.prg to fix it.
We have already located and fixed some issues:
1. Class TXBrowse Method CancelEdit(). This line should be removed:
// oCol:oEditGet:nLastKey := VK_RETURN
2. In mallorca.prg change this lines:
oBrw:aCols[1]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,1] := xVal,) }
oBrw:aCols[2]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,2] := xVal,) }
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
In METHOD Edit( nKey ) CLASS TXBrwColumn, change:
into this:
In the same method change:
into this:
Code: Select all
if ::bEditValid != nil
::oEditGet:bValid := ::bEditValid
endif
Code: Select all
if ::bEditValid != nil
::oEditGet:bValid := { | oGet, lRet | ::oEditGet:lValidating := .T., lRet := Eval( ::bEditValid, oGet ), ::oEditGet:lValidating := .F., lRet }
endif
Code: Select all
::oEditGet:bLostFocus := { || ::PostEdit() }
Code: Select all
::oEditGet:bLostFocus := { || If( ! ::oEditGet:lValidating, ::PostEdit(),) }
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
In In METHOD Edit( nKey ) CLASS TXBrwColumn, this is a better fix as it returns the focus to the GET if the VALID return .F.:
Code: Select all
if ::bEditValid != nil
::oEditGet:bValid := { | oGet, lRet | ::oEditGet:lValidating := .T., lRet := Eval( ::bEditValid, oGet ), ::oEditGet:lValidating := .F., If( ! lRet, ::oEditGet:SetFocus(),), lRet }
endif
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
In method Edit() this is a better fix:
Code: Select all
::oEditGet:bLostFocus := { || If( ::oEditGet != nil .and. ! ::oEditGet:lValidating, ::PostEdit(),) }
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Proper fix for Method CancelEdit():
Code: Select all
METHOD CancelEdit() CLASS TXBrowse
local oCol, nFor, nlen
if ! ::lEditMode
return nil
endif
nLen := Len( ::aCols )
for nFor := 1 to nLen
oCol := ::aCols[ nFor ]
if oCol:oEditGet != nil
oCol:oEditGet:VarPut( Eval( oCol:bEditValue ) )
oCol:oEditGet:bValid = nil
oCol:PostEdit()
endif
next
::lEditMode := .f.
return nil
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
This fix is required in Class TXBrwColumn Method PaintData(), so if a VALID is .F. then the column is properly painted. Change this:
into this:
We are getting close to have samples\mallorca.prg working fine
Code: Select all
if ::oEditGet != nil .or. ::oEditLbx != nil .or. ::oBrw:nLen == 0
return nil
endif
Code: Select all
if ( ::oEditGet != nil .and. nRow == ::oBrw:nRowSel ) .or. ::oEditLbx != nil .or. ::oBrw:nLen == 0
return nil
endif
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Avoiding the VALID if escape is pressed:
Code: Select all
static function EditGetkeyDown( Self, nKey )
...
case nKey == VK_ESCAPE
lExit := .t.
::oEditGet:bValid = nil
...
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Here you have the new mallorca.exe:
http://www.hotshare.net/file/25599-33319869aa.html
Please test it and see if you can break it, thanks
There is a pending painting issue when returning from the VALID (a painted frame around the GET). We are working to solve it.
http://www.hotshare.net/file/25599-33319869aa.html
Please test it and see if you can break it, thanks
There is a pending painting issue when returning from the VALID (a painted frame around the GET). We are working to solve it.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Thanks Mr Antonio. Extremely happy that we are now getting reliable inline edit for our favourite xBrowse.
I have been working on this issue, but now that you have done the most part of it I shall adopt your changes now.
Are these the only changes to the source code ? I adopt them and make extensive tests.
My first test with mallorca.exe is working well.
I have been working on this issue, but now that you have done the most part of it I shall adopt your changes now.
Are these the only changes to the source code ? I adopt them and make extensive tests.
My first test with mallorca.exe is working well.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Nageswararao,
>
Are these the only changes to the source code ? I adopt them and make extensive tests.
>
Yes, the ones that I have published here.
> My first test with mallorca.exe is working well.
This is samples\mallorca.prg with some little changes:
>
Are these the only changes to the source code ? I adopt them and make extensive tests.
>
Yes, the ones that I have published here.
> My first test with mallorca.exe is working well.
This is samples\mallorca.prg with some little changes:
Code: Select all
# INCLUDE "FiveWin.ch"
# INCLUDE "XBrowse.ch"
//-------------
FUNCTION Main()
//-------------
LOCAL oWnd,aLin:={},i,oBrw
FOR i:=1 TO 6
AAdd(aLin,{i,'Descripción '+Str(i)})
NEXT
DEFINE WINDOW oWnd
//--Definición Objeto TxBrowse
oBrw:=TxBrowse():New(oWnd)
oBrw:SetArray(aLin)
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:aCols[1]:cHeader := 'Cod'
oBrw:aCols[1]:cEditPicture := '@k 99'
oBrw:aCols[1]:bClrEdit := oBrw:bClrStd
oBrw:aCols[1]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,1] := xVal,) }
oBrw:aCols[1]:nEditType := EDIT_GET
oBrw:aCols[1]:bEditValid := { | oGet | Valida( oGet ) } //<========
//--
oBrw:aCols[2]:cHeader := 'Descripción'
oBrw:aCols[2]:bClrEdit := oBrw:bClrStd
oBrw:aCols[2]:bOnPostEdit := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt,2] := xVal,) }
oBrw:aCols[2]:nEditType := EDIT_GET
//--
oBrw:CreateFromCode()
oBrw:bRClicked = { | nRow, nCol | ShowPopup( nRow, nCol, oBrw, aLin ) }
oWnd:oClient:=oBrw
ACTIVATE WINDOW oWnd
RETURN NIL
STATIC FUNCTION Valida( oGet )
IF oGet:Value() > 6
MsgAlert( "Must be lower than 7" )
return .F.
ENDIF
RETURN .T.
function ShowPopup( nRow, nCol, oBrw, aLin )
local oMenu
MENU oMenu POPUP
MENUITEM "Add" ACTION ( AAdd( aLin, { AllTrim( Str( Len( aLin ) + 1 ) ), "New item" } ), oBrw:SetArray( aLin ), oBrw:Refresh() )
MENUITEM "Del" ACTION ( ADel( aLin, oBrw:nArrayAt ), ASize( aLin, Len( aLin ) - 1 ), oBrw:SetArray( aLin ), oBrw:Refresh() )
MENUITEM "Select" ACTION ( oBrw:GoTop(), oBrw:nArrayAt := 3, oBrw:Refresh() )
ENDMENU
ACTIVATE POPUP oMenu WINDOW oBrw AT nRow, nCol
return nil
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Mr Antonio
Great. Almost all the problems I faced earlier seem to have been addressed. I shall continue my tests on other data also.
At this point only one observation that the EditValid block is getting evaluated twice. Can this be avoided?
After solving the inline edit issue, you have to address the listbox issue also. Once the user presses on the arrow, the listbox is shown. After the user moves around the listbox, he has no way to cancel ( esc does not help) and retain the original value unchanged.
We shall be glad if you keep publishing whatever changes you keep making with regards to edits.
Great. Almost all the problems I faced earlier seem to have been addressed. I shall continue my tests on other data also.
At this point only one observation that the EditValid block is getting evaluated twice. Can this be avoided?
After solving the inline edit issue, you have to address the listbox issue also. Once the user presses on the arrow, the listbox is shown. After the user moves around the listbox, he has no way to cancel ( esc does not help) and retain the original value unchanged.
We shall be glad if you keep publishing whatever changes you keep making with regards to edits.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Problem:
Enter an invalid value in the first column. Say enter 9 and press Enter key. As expected the valid msg is shown twice and the focus remains on the get.
Without doing anything click on any other program window. Then the invalid value is written and cursor moves to next column
Enter an invalid value in the first column. Say enter 9 and press Enter key. As expected the valid msg is shown twice and the focus remains on the get.
Without doing anything click on any other program window. Then the invalid value is written and cursor moves to next column
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
I made the changes you published. For the sake of clarity I made the changes in a derived class. With that I compiled your mallorca program ( latest version).
There seems to be slight difference in behavior between your exe and what i compiled here. I may need to check if i made all the corrections properly.
There seems to be slight difference in behavior between your exe and what i compiled here. I may need to check if i made all the corrections properly.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India