Bug report on listbox

Post Reply
Piscicelli Zingoni
Posts: 76
Joined: Wed Oct 12, 2005 5:52 pm
Location: Milan,Italy

Bug report on listbox

Post 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
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

you forget this :

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

Hoe, email: easywin3@yahoo.com
Piscicelli Zingoni
Posts: 76
Joined: Wed Oct 12, 2005 5:52 pm
Location: Milan,Italy

Post by Piscicelli Zingoni »

Many tanks!
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Post 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
Ciao, best regards,
Ugo
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Post by Ugo »

Good solution! :-)
Can you insert in next release?
Ciao, best regards,
Ugo
Post Reply