XBrowse online editing

Postby Antonio Linares » Wed Dec 26, 2007 11:18 am

Nageswararao,

> Still the issue of the behavior when Valid Block opens any new dialog remains

Fixed :-) These changes are required:
Code: Select all  Expand view
::oEditGet:bValid := { | oGet, lRet | oGet:lValidating := .T., lRet := Eval( ::bEditValid, oGet, Self ), oGet:lValidating := .F., If( ! lRet, oGet:SetFocus(),), lRet }
...
static function EditGetLostFocus(...)
   ...
   if ( oWnd := oWndFromHwnd( hWndFocus ) ) != nil .and. ! ( oWnd == oBrw ) .and. ;
      Upper( oWnd:ClassName() ) != "TGET"  // new!!!
      oBrw:CancelEdit()
      SetFocus( hWndFocus )               
      return nil
   endif   
   ...

The above "TGET" could be extended with the allowed controls to get focus from a VALID process.
In mallorca.prg these changes are required:
Code: Select all  Expand view
oBrw:aCols[1]:bEditValid   := { | oGet, oCol | Valida( oGet, oCol ) }
...
STATIC FUNCTION Valida( oGet, oCol )
   
   local nVal := 0

   if oGet:Value() > 6
      MsgAlert( "Must be lower than 7" )
      if MsgGet( "New value", "Enter number between 1 and 6", @nVal )
         if nVal > 0 .and. nVal < 7
            oGet:VarPut( nVal )
            oCol:PostEdit()
            return .T.
          endif
      endif   
      return .F.
    endif

return .T.

A new mallorca.exe build:
http://www.hotshare.net/file/25998-4690817f9b.html
regards, saludos

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

Postby Antonio Linares » Wed Dec 26, 2007 11:42 am

Nageswararao,

This first line seems wrong:

oBrw:aCols[3]:aEditListBound:= ;
oBrw:aCols[3]:aEditListTxt := { 'AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH' }
regards, saludos

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

Postby nageswaragunupudi » Wed Dec 26, 2007 11:47 am

If the data is numeric, ListBound should be { 1,2,3....}. In our case the data stored in the data ( array) is the same as display values. If we specify only litttxt the browse derives listbound with { 1,2,3 } and returns those values. Therefore what i wrote is correct and it works. Only problem is that user is not able to abandon edit and retain the original values.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Wed Dec 26, 2007 11:50 am

Nageswararao,

> Therefore what i wrote is correct and it works.

Yes, you are right. Now I see what you meant. Thanks! :-)
regards, saludos

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

Postby nageswaragunupudi » Wed Dec 26, 2007 11:51 am

I tried the revised exe posted. It is working ok. As you said we may need to cover other usual controls used in popup helps that may be used in valid functions. ( I am working with changing my copy of txbrowse ).
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Wed Dec 26, 2007 11:55 am

I am trying listbox issues. I think the behaviour should be if the user clicks the mouse elsewhere, the original value should be retained. If he is navigating with keys, if he presses escape, the listbox should end and original value retained.

But :bKeyDown of listbox is not intercepting Escape key
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Wed Dec 26, 2007 12:00 pm

I made the following changes in the ShowBtnList( nKey ) method.
Code: Select all  Expand view
//   ::oEditLbx:bLostFocus := {|| ::PostEdit( aBound[ Max( 1, nAt ) ], .t. ) } // iif(::oEditLbx != nil, ::oEditLbx:End(),) } A.L. Nov 2007
   ::oEditLbx:bLostFocus := {|| ::PostEdit( eval(::bEditValue), .t. ) }
.................
                                }
/*
   ::oEditLbx:bKeyDown   := {|k| iif( k == VK_RETURN .and. nAt > 0,  xValue := aBound[ nAt ], ),;
                                 iif( k == VK_RETURN .or. k == VK_ESCAPE, ::PostEdit( xValue, .t. ), ) }
*/

   ::oEditLbx:bKeyDown   := ;
         {|k| iif( k == VK_RETURN .and. nAt > 0, ;
                   ::PostEdit( aBound[ nAt ], .t. ) , ;
                   iif( k == VK_ESCAPE, ::PostEdit( eval(::bEditValue), .t. ), nil ) ) }

But escape key is not captured at all
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Wed Dec 26, 2007 12:11 pm

I carried out the corrections. I don't what I am missing but I am getting an error
Code: Select all  Expand view
Application
===========
   Path and name: C:\TESTS\Bin\MALLORCA.Exe (32 bits)
   Size: 1,437,184 bytes
   Time from start: 0 hours 0 mins 7 secs
   Error occurred at: 12/26/07, 17:53:59
   Error description: Error BASE/1005  Class: 'NIL' has no property: NLASTKEY
   Args:
     [   1] = U   
     [   2] = N   13

Stack Calls
===========
   Called from:  => _NLASTKEY(0)
   Called from: xbrowse.prg => EDITGETKEYDOWN(4543)
   Called from: xbrowse.prg => (b)TXBRWCOLUMN:EDIT(4479)
   Called from: WINDOW.PRG => TWINDOW:KEYDOWN(0)
   Called from: CONTROL.PRG => TCONTROL:KEYDOWN(0)
   Called from: TGET.PRG => TGET:KEYDOWN(0)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
   Called from: TGET.PRG => TGET:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => WINRUN(0)
   Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
   Called from: MALLORCA.PRG => MAIN(59)
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Wed Dec 26, 2007 12:47 pm

I am still getting the above error from the application I linked. Your exe downloaded is working fine. I am wondering what is the difference.

This is the valida method I am using as advised by you
Code: Select all  Expand view
STATIC FUNCTION Valida( oGet, oCol )

   local nnew  := 0
   local method := 2

   if method == 1
      return ( oget:varget() <= 6 )

   elseif method == 2
    IF oGet:Value() > 6
       MsgAlert( "Must be lower than 7" )
       if msgget('NEW VALUE','Enter number between 1 and 6',@nnew)
          if nnew > 0 .and. nnew < 7
             oGet:varput( nnew )
//             oget:refresh()
//             oget:nLastKey := VK_RETURN
//             msginfo(oget:varget())
             oCol:PostEdit()
             return .t.
          else
             return .f.
          endif
       endif
       return .F.
    ENDIF

elseif method == 3
    if oget:value() > 6
       oget:varput(6)
       oget:refresh()
    endif
endif

RETURN .T.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Thu Dec 27, 2007 9:48 am

Nageswararao,

> I made the following changes in the ShowBtnList( nKey ) method.

Fixed. Required changes:
Code: Select all  Expand view
METHOD ShowBtnList( nKey ) CLASS TXBrwColumn
   ...
   ::oBrw:lEditMode := .T.

return .T.

Code: Select all  Expand view
METHOD CancelEdit() CLASS TXBrowse
   ...
   for nFor := 1 to nLen
        ...
        if oCol:oEditLbx != nil
           oCol:oEditLbx:End()
        endif   
   next
...

Now the click on a buttonbar and fire its action is missing, when the listbox is showing. Working on it :-)
Last edited by Antonio Linares on Thu Dec 27, 2007 9:51 am, edited 1 time in total.
regards, saludos

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

Postby Antonio Linares » Thu Dec 27, 2007 9:50 am

A new mallorca.exe build:
http://www.hotshare.net/file/26219-85426459f1.html

Thanks for your feedback! :-)
regards, saludos

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

Postby Antonio Linares » Thu Dec 27, 2007 10:14 am

Moving the listbox item with the keyboard and then escape was wrongly assigning the selected item. Fixed:
Code: Select all  Expand view
METHOD ShowBtnList( nKey ) CLASS TXBrwColumn
...
   ::oEditLbx:bKeyDown   := {|k| ::oEditLbx:nLastKey := k,;  // new!
                                   If( k == VK_RETURN .and. nAt > 0,  xValue := aBound[ nAt ], ),;
                                 If( k == VK_RETURN .or. k == VK_ESCAPE, ::PostEdit( xValue, .t. ), ) }
...

Code: Select all  Expand view
METHOD KeyChar( nKey ) CLASS TXBrowse
...
      case nKey == VK_ESCAPE
              ...
           if ::lEditMode
              oCol := ::SelectedCol() 
              if oCol:oEditLbx != nil
                 oCol:oEditLbx:nLastKey = VK_ESCAPE
              endif   
              ::CancelEdit()
           endif
...

And finally in mallorca.prg:
Code: Select all  Expand view
   oBrw:aCols[3]:bOnPostEdit  := { | oCol, xVal, nKey | If( nKey == VK_RETURN, aLin[ oBrw:nArrayAt, 3 ] := xVal,) }

A new mallorca.exe build:
http://www.hotshare.net/file/26227-6326669358.html
regards, saludos

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

Postby nageswaragunupudi » Thu Dec 27, 2007 3:56 pm

Mr Antonio

I tested the latest exe posted by you. Keyboard edit of listbox is working okay. But I am not able to change the item with mouse. If I activate the listbox and click on any item, that item is not assigned.

Now the click on a buttonbar and fire its action is missing, when the listbox is showing. Working on it

It would be nice if this works. But not such a priority.

Small suggestion. You may increase the column width a little more when a button is shown in the column. Now the text is getting truncated a little.

I shall incorporate your changes in my copy and test it again.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Thu Dec 27, 2007 4:11 pm

Guess by oversight you might have omitted the correction to be made in postedit method

Original Code
Code: Select all  Expand view
      case ::nEditType == EDIT_LISTBOX
            < .... code ... >
           Eval( ::bOnPostEdit, Self, xValue, 0)

Last line should be changed to
Code: Select all  Expand view
          Eval( ::bOnPostEdit, Self, xValue, ::oEditLbx:nLastKey )

Please confirm.

You may also consider why cant we use Combobox instead of Listbox? This easily covers EDIT_LISTBOX and EDIT_GET_LISTBOX cases easily
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Thu Dec 27, 2007 4:20 pm

Made these changes. My changes are untidy though

Code: Select all  Expand view
method postedit ( ..... )
...
local nlastkey := 0
....

      case ::nEditType == EDIT_LISTBOX
           if ::oEditLbx != nil .and. IsWindow( ::oEditLbx:hWnd )
              nlastkey := ::oEditLbx:nlastkey
              ::oEditLbx:End()
              ::oEditLbx := nil
           endif
           if lbutton == .t.
              nLastKey := VK_RETURN
           endif
           Eval( ::bOnPostEdit, Self, xValue, nLastKey )   


Now both keyboard edit and mouse selection both assign the selected value. And Escape key retains the original value.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests