Required Fix for Class TListBox and TComboBox

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Required Fix for Class TListBox and TComboBox

Post by Antonio Linares »

In Method Add() please add this line:

Code: Select all

METHOD Add( cItem, nAt ) CLASS TListBox

   DEFAULT nAt := Len( ::aItems )

   cItem = FW_AnsiToWide( cItem )  // New !!!

   if nAt == Len( ::aItems )
      AAdd( ::aItems, cItem )
      ::SendMsg( LB_ADDSTRING, 0, cItem )
   else
      ASize( ::aItems, Len( ::aItems ) + 1 )
      AIns( ::aItems, nAt + 1 )
      ::aItems[ nAt + 1 ] = cItem
      ::SendMsg( LB_INSERTSTRING, nAt, cItem )
   endif

   ::SendMsg( LB_SETCURSEL, nAt )

return nil
Replace all calls to AnsiToWide() in listbox.prg with FW_AnsiToWide()

And add this function to listbox.prg:

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>

LPWSTR AnsiToWide( char * );

HB_FUNC( FW_ANSITOWIDE )
{
  LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
  int iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, hb_parc( 1 ), -1, 0, 0 );

  hb_retclen( ( char * ) pW, ( hb_parclen( 1 ) * 2 ) + 1 );
  hb_xfree( pW );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Required Fix for Class TListBox and TComboBox

Post by Antonio Linares »

The same fix is required for Class TComboBox: (source\classes\combobox.prg)

1. Replace all calls to AnsiToWide() with FW_AnsiToWide()

2. If you already added HB_FUNC( FW_ANSITOWIDE ) in listbox.prg then don't add it to combobox.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Required Fix for Class TListBox and TComboBox

Post by Antonio Linares »

You can modify, compile and replace modules in the FWPPC libraries, this way:

go.bat

Code: Select all

c:\harbour_ce\bin\harbour classes\listbox.prg /L /N /W /D__FWCE__  /I..\include;c:\harbour_ce\include
c:\harbour_ce\bin\harbour classes\combobox.prg /L /N /W /D__FWCE__  /I..\include;c:\harbour_ce\include
c:\vce\bin\clarm -c -TP /DARM /DUNICODE -Ic:\harbour_ce\include -Ic:\vce\include\arm listbox.c
c:\vce\bin\clarm -c -TP /DARM /DUNICODE -Ic:\harbour_ce\include -Ic:\vce\include\arm combobox.c
c:\vce\bin\lib ..\lib\Fivece.lib /remove:objce\LISTBOX.obj
c:\vce\bin\lib ..\lib\Fivece.lib /remove:objce\COMBOBOX.obj
c:\vce\bin\Lib ..\lib\Fivece.lib /OUT:..\lib\Fivece.lib listbox.obj
c:\vce\bin\Lib ..\lib\Fivece.lib /OUT:..\lib\Fivece.lib combobox.obj
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Required Fix for Class TListBox and TComboBox

Post by Antonio Linares »

We have just published a new FWPPC 9.01 build with these changes :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Required Fix for Class TListBox and TComboBox

Post by Antonio Linares »

Important:

clarm flag -TP should not be used as we don't want C++ mode
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply