xBrowse bValid

xBrowse bValid

Postby Detlef Hoefner » Fri Jun 15, 2007 10:28 pm

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Antonio Linares » Fri Jun 15, 2007 10:55 pm

Detlef,

If you comment out this line in mallorca.prg:
Code: Select all  Expand view
    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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Detlef Hoefner » Sat Jun 16, 2007 11:08 am

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Detlef Hoefner » Mon Jun 18, 2007 8:08 pm

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Antonio Linares » Mon Jun 18, 2007 11:14 pm

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Detlef Hoefner » Tue Jun 19, 2007 6:56 am

Antonio,

sorry, but it still doesn't work.

If i remove the line
Code: Select all  Expand view
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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Antonio Linares » Tue Jun 19, 2007 8:25 am

Detlef,

I didn't meant to remove it. My point is that it does not seems to be the right code
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Detlef Hoefner » Tue Jun 19, 2007 8:37 am

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. :cry:

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Rossine » Wed Jun 20, 2007 12:51 pm

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  Expand view
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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby Detlef Hoefner » Thu Jun 21, 2007 7:14 am

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests