Required Fix for Class TListBox and TComboBox

Required Fix for Class TListBox and TComboBox

Postby Antonio Linares » Sun Feb 01, 2009 9:36 pm

In Method Add() please add this line:
Code: Select all  Expand view
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  Expand view
#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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Required Fix for Class TListBox and TComboBox

Postby Antonio Linares » Sun Feb 01, 2009 10:08 pm

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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Required Fix for Class TListBox and TComboBox

Postby Antonio Linares » Sun Feb 01, 2009 11:07 pm

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

go.bat
Code: Select all  Expand view
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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Required Fix for Class TListBox and TComboBox

Postby Antonio Linares » Sun Feb 01, 2009 11:31 pm

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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Required Fix for Class TListBox and TComboBox

Postby Antonio Linares » Mon Feb 02, 2009 11:29 am

Important:

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

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


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 13 guests