FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBROWSE WITH EDIT_LISTBOX ERROR
Posts: 389
Joined: Wed Nov 29, 2006 01:51 PM
XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Mon Jul 26, 2010 01: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 (fw): Select all Collapse
#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.
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: 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 24.04, BCC 7 32 bit, MariaDB
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Thu Jul 29, 2010 04: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

Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Fri Jul 30, 2010 02: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
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Fri Jul 30, 2010 03:38 AM
Hua


Inside METHOD ShowBtnList( nKey ) CLASS TXBrwColumn


find
Code (fw): Select all Collapse
::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 (fw): Select all Collapse
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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Fri Jul 30, 2010 04:44 AM

Thank you for the prompt reply Daniel :)

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Fri Jul 30, 2010 01: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 (fw): Select all Collapse
      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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: XBROWSE WITH EDIT_LISTBOX ERROR
Posted: Mon Aug 02, 2010 01:22 AM

Noted. Thanks Daniel.

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion