XBROWSE WITH EDIT_LISTBOX ERROR

XBROWSE WITH EDIT_LISTBOX ERROR

Postby Ariel » Mon Jul 26, 2010 1:59 pm

Hi alls,

I have a xbrowse in a DIALOG and in a column with EDIT_LISTBOX, the case is that in edition instead of continuing to the following column, it goes on to the following control, in WINDOW it walks well, the problem presents it in dialogs and when we put another control besides the xbrowse, for example I have the xbrowse and a button, when I have a column with edit_listbox instead of going on to the near column of the browse, the focus goes on to the button

Here I leave an example that reproduces the mistake

Code: Select all  Expand view


#include "fivewin.ch"
#include "xbrowse.ch"

function main()

   local aData := {}
   local oWnd, oBrw, oBar

   define dialog oWnd size 600, 300

   @ 10,0 xbrowse oBrw of oWnd ;
      header 'one','two','tipo', "cuatro" ;
      columns 1, 2, 3, 4 ;
      colsizes 50,70,50,70 ;
      pictures '999','mmm dd, yyyy', "9999.99" ;
      SIZE 300, 300 PIXEL ;
      array aData lines cell fastedit footers

   WITH OBJECT oBrw
      :bClrStd    := { || If( oBrw:KeyNo() % 2 == 0, ;
                         { CLR_BLACK, RGB( 224, 236, 255 ) }, ;
                         { CLR_BLACK, RGB( 189, 211, 253 ) } ) }
      :bPastEof  := { || AddRow( oBrw ) }
      :bKeyDown := {| nKey | If( nKey == VK_DELETE, DelRow( oBrw ), ) }
   END

   AEval( oBrw:aCols, { |o| o:nEditType := EDIT_GET } )

   WITH OBJECT oBrw:tipo
      :nEditType        := EDIT_LISTBOX
      :aEditListBound   := ;
      :aEditListTxt     := { "NOV", "NTO", "TOR", "VAC", "VAQ", "TM ", "TH " }
   END
   WITH OBJECT oBrw:cuatro
      :nTotal        := 0
      :lTotal        := .t.
   END

   WITH OBJECT oBrw
      :bClrStd    := { || If( oBrw:KeyNo() % 2 == 0, ;
                         { CLR_BLACK, RGB( 224, 236, 255 ) }, ;
                         { CLR_BLACK, RGB( 189, 211, 253 ) } ) }
      :bPastEof  := { || AddRow( oBrw ) }
      :bKeyDown := {| nKey | If( nKey == VK_DELETE, DelRow( oBrw ), ) }
      :MakeTotals()
   END

   oBrw:CreateFromCode()
//   oWnd:oClient := oBrw

   @ 60,10 BUTTONBMP PROMPT "OK" OF oWnd ACTION oWnd:End() SIZE 120, 20 PIXEL

   activate dialog oWnd on init ( MakeBar( oWnd, oBrw ), oWnd:Resize() )

return nil

static function AddRow( oBrw )

   static n := 0

   AAdd( oBrw:aArrayData, { n, date()+n, "NOV", 0 } )
   n++
   oBrw:GoBottom()
   oBrw:Refresh()
   oBrw:SetFocus()

return nil

static function DelRow( oBrw )

   if oBrw:nLen > 0
      ADel( oBrw:aArrayData, oBrw:nArrayAt )
      ASize( oBrw:aArrayData, oBrw:nLen - 1 )
      oBrw:Refresh()
   endif
   oBrw:SetFocus()

return nil


function MakeBar( oWnd, oBrw )
   
   local oBar

   define buttonbar oBar size 100,32 of oWnd 2007
   define button of oBar prompt 'AddRow' action AddRow( oBrw )
   define button of oBar prompt 'DeleteRow' action DelRow( oBrw )

return oBar
 

 


Regards.
Ariel
 
Posts: 375
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby shri_fwh » Tue Jul 27, 2010 11:38 am

Hi ,

I am getting the same probem with EDIT_LISTBOX this is bug in the FW. We have to wait until it get fixed.


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby Daniel Garcia-Gil » Thu Jul 29, 2010 4:25 pm

Ariel

This change is required:

METHOD ShowBtnList( nKey ) CLASS TXBrwColumn

IF ::oBrw:oWnd:IsKindOf( "TDIALOG" )
::oEditLbx:nDlgCode = DLGC_WANTALLKEYS
::oEditLbx:bKeyDown := {|k| ::oEditLbx:nLastKey := k, nil }

ELSE
::oEditLbx:bKeyDown := {|k| ::oEditLbx:nLastKey := k, ;
If( k == VK_RETURN .and. nAt > 0, xValue := aBound[ nAt ], ),;
If( k == VK_RETURN .or. k == VK_ESCAPE, ::PostEdit( xValue, .t. ), ) }
ENDIF
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby hua » Fri Jul 30, 2010 2:37 am

Daniel,
Is the shown code to be placed immediately following the line "METHOD ShowBtnList( nKey ) CLASS TXBrwColumn"?

Another question is what to do with the pre-existing ::oEditLbx:bKeyDown in this method. Delete it?

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1070
Joined: Fri Oct 28, 2005 2:27 am

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby Daniel Garcia-Gil » Fri Jul 30, 2010 3:38 am

Hua


Inside METHOD ShowBtnList( nKey ) CLASS TXBrwColumn


find
Code: Select all  Expand view
::oEditLbx:bKeyDown := {|k| ::oEditLbx:nLastKey := k, ;
If( k == VK_RETURN .and. nAt > 0, xValue := aBound[ nAt ], ),;
If( k == VK_RETURN .or. k == VK_ESCAPE, ::PostEdit( xValue, .t. ), ) }


replace with
Code: Select all  Expand view
IF ::oBrw:oWnd:IsKindOf( "TDIALOG" )
::oEditLbx:nDlgCode = DLGC_WANTALLKEYS
::oEditLbx:bKeyDown := {|k| ::oEditLbx:nLastKey := k, nil }

ELSE
::oEditLbx:bKeyDown := {|k| ::oEditLbx:nLastKey := k, ;
If( k == VK_RETURN .and. nAt > 0, xValue := aBound[ nAt ], ),;
If( k == VK_RETURN .or. k == VK_ESCAPE, ::PostEdit( xValue, .t. ), ) }
ENDIF
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby hua » Fri Jul 30, 2010 4:44 am

Thank you for the prompt reply Daniel :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1070
Joined: Fri Oct 28, 2005 2:27 am

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby Daniel Garcia-Gil » Fri Jul 30, 2010 1:25 pm

Hua

from spanish forums is reported the problem still continued... please this change is required too

Change this CASE in METHOD KeyChar( nKey, nFlags ) CLASS TXBrowse
Code: Select all  Expand view

      case nKey == VK_RETURN
         oCol := ::SelectedCol()
         if oCol:oEditGet != nil
            PostMessage( oCol:oEditGet:hWnd, WM_KEYDOWN, nKey )   //VK_RETURN )
         elseif oCol:lEditable .and. ! oCol:hChecked .and. ::lEnterKey2Edit .and. ! ( oCol:nEditType == EDIT_LISTBOX .or. oCol:nEditType == EDIT_GET_LISTBOX )
            return oCol:Edit()
         elseif oCol:nEditType != EDIT_LISTBOX .or. oCol:nEditType != EDIT_GET_LISTBOX
            //Simulate Click over button for no lost focus
            PostMessage( oCol:oBtnList:hWnd, WM_LBUTTONDOWN, 1, 1 )  
            PostMessage( oCol:oBtnList:hWnd, WM_LBUTTONUP, 1, 1 )  
         elseif ::oTreeItem!=nil
            If( ::oTreeItem:oTree != nil,( ::oTreeItem:Toggle(), ::Refresh() ),)
         else
            ::GoRight()
         endif
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: XBROWSE WITH EDIT_LISTBOX ERROR

Postby hua » Mon Aug 02, 2010 1:22 am

Noted. Thanks Daniel.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1070
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 27 guests