Page 1 of 1

Bug report on listbox

Posted: Tue May 16, 2006 3:21 pm
by Piscicelli Zingoni
I cannot run this example in fwh:

#include "FiveWin.ch"

//----------------------------------------------------------------------------//
function Main()

local oDlg, oBrw
local aData := { { "1", "Cliente", "=", "123456" },;
{ "2", "Direccion", "$", "Spain" },;
{ "3", "Telefono", "<>", "889977665" } }

DEFINE DIALOG oDlg FROM 0, 0 TO 30, 100

@ 1, 1 LISTBOX oBrw FIELDS aData[ oBrw:nAt ][ 1 ],;
aData[ oBrw:nAt ][ 2 ],;
aData[ oBrw:nAt ][ 3 ],;
aData[ oBrw:nAt ][ 4 ] OF oDlg ;
SIZE 150, 100

oBrw:SetArray( aData )

@ 9 , 9 BUTTON "&End" OF oDlg ACTION oDlg:End()



ACTIVATE DIALOG oDlg CENTERED


any help?
Piscicelli/Zingoni

Posted: Wed May 17, 2006 8:00 pm
by tnhoe
you forget this :

headers "header1',"header2","header3","header4" ;

Posted: Wed May 17, 2006 9:18 pm
by Piscicelli Zingoni
Many tanks!

Posted: Fri May 19, 2006 8:12 am
by Ugo
For Antonio:
This problem is for the incorrect initialization of ::aHeaders into WBrowse Class!
I suggest this:

at line 1184:

Code: Select all

   if Len( ::aHeaders ) < nElements
      if ::Cargo == nil
         ::aHeaders = Array( nElements )
         IF Upper( ::cAlias ) != "ARRAY"       
            for n = 1 to nElements
               ::aHeaders[ n ] = ( cAlias )->( FieldName( n ) )
            next
         ELSE
            ::aHeaders := AFill( ::aHeaders, "" )
         ENDIF
      else
         ::aHeaders = { "" }
      endif
   endif
and at line 1824:

Code: Select all

   if ! Empty( ::cAlias ) .and. Upper( ::cAlias ) != "ARRAY"  // aggiunto da Ugo il 22/03/04

      ::bGoTop     = If( uVal1 != nil, { || ( ::cAlias )->( DbSeek( uVal1, .t. ) ) },;
                                    { || ( ::cAlias )->( DbGoTop() ) } )

      ::bGoBottom  = If( uVal2 != nil, { || ( ::cAlias )->( BrwGoBottom( uVal2 ) ) },;
                                    { || ( ::cAlias )->( DbGoBottom() ) } )

      ::bSkip      = If( uVal1 != nil, BuildSkip( ::cAlias, cField, uVal1, uVal2 ),;
                      { | n | ( ::cAlias )->( _DbSkipper( n ) ) } )

      ::bLogicLen  = If( uVal1 != nil,;
                      { || ( ::cAlias )->( Self:RecCount( uVal1 ) ) },;
                      { || ( ::cAlias )->( RecCount() ) } )

      ::nLen       = Eval( ::bLogicLen, Self )

      ::lHitTop    = .f.
      ::lHitBottom = .f.

      if uVal1 != nil
         Eval( ::bGoTop, Self )
      endif
   else
      ::bLogiclen = { || 0 }
   endif

Posted: Fri May 19, 2006 11:03 am
by Antonio Linares
Ugo,

This way we have a number for each column:

Code: Select all

   if Len( ::aHeaders ) < nElements
      if ::Cargo == nil
         ::aHeaders = Array( nElements )
         for n = 1 to nElements
             if ! Empty( cAlias ) .and. Upper( cAlias ) != "ARRAY"
                ::aHeaders[ n ] = ( cAlias )->( FieldName( n ) )
             else
                ::aHeaders[ n ] = AllTrim( Str( n ) )
             endif   
         next
      else
         ::aHeaders = { "" }
      endif
   endif

Posted: Fri May 19, 2006 11:13 am
by Ugo
Good solution! :-)
Can you insert in next release?