Page 1 of 1

Xbrowse and EDIT_LISTBOX solved

Posted: Tue Oct 29, 2019 5:00 pm
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

Re: Xbrowse and EDIT_LISTBOX

Posted: Wed Oct 30, 2019 5:15 pm
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" ?

Re: Xbrowse and EDIT_LISTBOX solved

Posted: Thu Oct 31, 2019 9:39 am
by Maurizio
now works :D
Thanks RAO
www.nipeservice.it