Xbrowse and EDIT_LISTBOX solved

Post Reply
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Xbrowse and EDIT_LISTBOX solved

Post by Maurizio »

Hello Rao ,
is it possible to see the description ( item 0 ) when I have a value = zero?

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd, aLin := {{0,"",0}}, i, oBrw, oBtn
   local aTabla:= { {  0, "item  0",  0.00 },;
                          {  1, "item  1",  1.00 },;
                          {  2, "item  2",  2.00 },;
                          {  3, "item  3",  3.00 } }

   DEFINE WINDOW oWnd

   @ 10,10 XBROWSE oBrw OF oWnd DATASOURCE aLin ;
      COLUMNS 1, 1, 3 ;
      HEADERS 'Cod', 'Description', 'Price' ;
      CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw
      WITH OBJECT :Description
         :nEditType     := EDIT_LISTBOX
         :aEditListTxt  := aTabla
         :bOnChange     := { || oBrw:aRow[ 3 ] := aTabla[ oBrw:aRow[ 1 ], 3 ], ;
                                oBrw:aRow[ 2 ] := aTabla[ oBrw:aRow[ 1 ], 2 ] }
      END
      :bPastEof   := <||
         if oBrw:nLen == 0 .or. !Empty( ATail( oBrw:aArrayData )[ 1 ] )
            AAdd( oBrw:aArrayData, { 0, "", 0 } )
            oBrw:GoDown()
            oBrw:Refresh()
         endif
         return nil
         >
      :CreateFromCode()
   END

   oWnd:oClient   := oBrw

   ACTIVATE WINDOW oWnd CENTERED

RETURN NIL
Maurizio
Last edited by Maurizio on Thu Oct 31, 2019 9:40 am, edited 1 time in total.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Xbrowse and EDIT_LISTBOX

Post by nageswaragunupudi »

Can you please modify xbrowse.prg as below and try?

Please locate "static function XbrLbxLookUp( uVal, aBound, aText, lBlank )" in the xbrowse.prg.
Inside this function locate this line:

Code: Select all

   if ! Empty( uVal )
 
Please change it as:

Code: Select all

   if .T.  //! Empty( uVal )
 
Can you check if you can now see "item.0" ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: Xbrowse and EDIT_LISTBOX solved

Post by Maurizio »

now works :D
Thanks RAO
www.nipeservice.it
Post Reply