Page 1 of 1
xBrowse bValid
Posted: Fri Jun 15, 2007 10:28 pm
by Detlef Hoefner
Dear friends,
i'm still busy to learn all aspects of the xBrowse class and found a new problem.
To see how a valid clause may be used with a xBrowse cell edit I built the sample mallorca.
In this example the valid block gives a message if the entered value is bigger than 6 and returns false.
But after showing the message a wrong value is assigned to the cell.
Is there an other way to get a valid clause working as expected?
Regards,
Detlef
Posted: Fri Jun 15, 2007 10:55 pm
by Antonio Linares
Detlef,
If you comment out this line in mallorca.prg:
Code: Select all
IF nVal>6
// MsgAlert('No puede ser mayor que 6')
lValRet:=.f.
ENDIF
then it works fine. The problem is that the MsgAlert() causes the GET to loose the focus and then its current value its assigned
We should find a way to accept Msg...() (or similar) calls.
Posted: Sat Jun 16, 2007 11:08 am
by Detlef Hoefner
Antonio,
thanks for your advice. But it still doesn't work for me.
I removed the MsgAlert so that the validating function returns .f. for values > 6 and .t. for all others.
But the example mallorca shows a very strange editing/validating of TxBrowse.
Example:
i enter a '7' and press return.
Nothing happens, the 7 is shown but not accepted. This is ok.
But when now pressing Esc, the 7 is accepted and i can move to an other cell.
I now go back to the cell with the 7 and enter a '2' and press return.
The 2 disappears, the 7 shows up again and after leaving the cell, the 2 is properly displayed.
This is a very confusing kind of editing.
Perhaps its only on my environment or can someone confirm this behaviour?
Thanks and regards,
Detlef
Posted: Mon Jun 18, 2007 8:08 pm
by Detlef Hoefner
Dear friends,
is there no one who could confirm or try this strange validating of xBrowse?
I'd be glad for any statement.
Regards,
Detlef
Posted: Mon Jun 18, 2007 11:14 pm
by Antonio Linares
Detlef,
In mallorca.prg sample, this line seems not to be needed:
oBrw:aCols[1]:bOnPostEdit := {|o,x| aLin[ oBrw:nArrayAt,1] := x }
as such assignment should be done by the GET itself
Posted: Tue Jun 19, 2007 6:56 am
by Detlef Hoefner
Antonio,
sorry, but it still doesn't work.
If i remove the line
Code: Select all
oBrw:aCols[1]:bOnPostEdit := {|o,x| aLin[ oBrw:nArrayAt,1] := x }
the program complains at runtime that onPostEdit is not defined.
If i set it to NIL, i can not enter new values because they are not assigned.
Regards,
Detlef
Posted: Tue Jun 19, 2007 8:25 am
by Antonio Linares
Detlef,
I didn't meant to remove it. My point is that it does not seems to be the right code
Posted: Tue Jun 19, 2007 8:37 am
by Detlef Hoefner
Antonio,
i know, you didn't say to remove this line.
But you said
... as such assignment should be done by the GET itself
But the get doesn't assign the value as expected.
Regards,
Detlef
Posted: Wed Jun 20, 2007 12:51 pm
by Rossine
Hello Detlef,
Do these changes in xbrowse.prg and see functions correctly. Case does not function an example citing problem sends me.
Code: Select all
METHOD PostEdit( xValue, lButton ) CLASS TXBrwColumn
local lGoNext := .f.
If ::lOnPostEdit
return nil
Endif
::lOnPostEdit := .t.
DEFAULT lButton := .f.
if !getkeystate( VK_ESCAPE )
if ::oEditGet != nil && By Rossine 09/06/07
if valtype( ::oEditGet ) = "O" .and. ::oEditGet:bValid != NIL
if !Eval( ::bEditValid, ::oEditGet )
Eval( ::bOnPostEdit, Self, ::oEditTmp )
::oEditGet:varput(::oEditTmp)
::oEditGet:refresh()
::lOnPostEdit := .f.
return .F.
endif
endif
elseif ::oEditLbx != nil && By Rossine 09/06/07
if valtype( ::oEditLbx ) = "O" .and. ::oEditLbx:bValid != NIL
if !Eval( ::bEditValid, ::oEditLbx )
Eval( ::bOnPostEdit, Self, ::oEditTmp )
::oEditLbx:varput(::oEditTmp)
::oEditLbx:refresh()
::lOnPostEdit := .f.
return .F.
endif
endif
endif
endif
Regards,
Rossine.
Posted: Thu Jun 21, 2007 7:14 am
by Detlef Hoefner
Hello Rossine,
thanks a lot for your advice.
Now invalid entries combined with Esc key are properly processed.
But unfortunately i can't input valid values.
The sample i'm speaking about is mallorca.prg in the samples folder of FWH.
My intention was to find a replacement for Manuel Mercado's TsBrowse because it has some strange behaviours.
But now i see that xBrowse isn' much more mature
.
Anyhow thanks again for your help.
I think i'll try Hernan's TwBrowse instead.
Regards,
Detlef