xBrowse bValid
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
xBrowse bValid
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Detlef,
If you comment out this line in mallorca.prg:
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.
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
We should find a way to accept Msg...() (or similar) calls.
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
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
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
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
Antonio,
sorry, but it still doesn't work.
If i remove the line
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
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 }
If i set it to NIL, i can not enter new values because they are not assigned.
Regards,
Detlef
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
Hello Detlef,
Do these changes in xbrowse.prg and see functions correctly. Case does not function an example citing problem sends me.
Regards,
Rossine.
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
Rossine.
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
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
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