FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ๊TGET problem with FW_SetUnicode(.T.)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
๊TGET problem with FW_SetUnicode(.T.)
Posted: Wed Jun 29, 2016 10:20 AM
I have use FW_SETUNICODE(.T.) in the program.
When I len() to check Length of variable and it show 3 but I cannot type anything.
If I clear the text and type again;
English : can type up to 3 charactors
Thai : can type 1 charactor (I think TGET understand that is 3 bytes already, because of Unicode text)
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()
   LOCAL oDlg, oGet
   LOCAL cCad := "ทด " // pad("Testing Gets",40)
   LOCAL nNum := 0
   LOCAL dDat := Date()

   Set century On
   Set Date Ansi
   Set Date format "mm/dd/yyyy"

   SET _3DLOOK ON

   FW_SetUnicode(.T.)

   ?len(cCad)

   DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION

   @ 1,    2 SAY "Text..:" OF oDlg
   @ 1,    6 GET oGet VAR cCad OF oDlg SIZE 60, 10 COLOR "W/G"
   @ 1.8,  2 SAY "Number:" OF oDlg
   @ 2,    6 GET oGet VAR nNum OF oDlg SIZE 60, 10 PICTURE "9999999.99"
   @ 2.6,  2 SAY "Date:" OF oDlg
   @ 3,    6 GET oGet VAR dDat PICTURE "@E" OF oDlg SIZE 60, 10  // "@D"
   @ 3,    7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL
   
   // TGet():SetColorFocus( nRGB( 200, 120, 120 ) )

   ACTIVATE DIALOG oDlg CENTERED

return nil

//------------------------------------------------------------------------//

procedure appsys // XBase++ requirement
return
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: ๊TGET problem with FW_SetUnicode(.T.)
Posted: Wed Jun 29, 2016 01:19 PM
I used FWH 1512 / xHarbour 1.2.3 (FW) / BCC7.
I've changed TGET 2 place. It look better but there are not compatible case such as copy and paste.

Do the current version 1604 fully support TGET on Unicode?
Code (fw): Select all Collapse
#ifdef UTFREVN

   METHOD SetText( cText ) INLINE ( If( ::lUnicode .and. ::oGet:Type == 'C', ;
                                    If( ::lPassword, cText := Trim( cText ), ;  
                                    cText := FW_UTF8PADR( cText, iif(IsUtf8( Eval( ::bSetGet )),HB_UTF8LEN( Eval( ::bSetGet ) ),len(Eval( ::bSetGet ))) /*Len( Eval( ::bSetGet ) ) */ ) ), ), ;
                                    SetWindowText( ::hWnd, cText ) )

   METHOD GetText() INLINE If( ::lUnicode .and. ::oGet:Type == 'C', ;
                               FW_UTF8PADR( GetWindowText( ::hWnd ), iif(IsUtf8( Eval( ::bSetGet )),HB_UTF8LEN( Eval( ::bSetGet ) ),len(Eval( ::bSetGet )))/*Len( Eval( ::bSetGet )*/ ), ;
                               GetWindowText( ::hWnd ) )

#endif

Code (fw): Select all Collapse
function FW_UTF8PADR( cText, nLen )
cText    := Trim( cText )
   if IsUtf8( cText )
      do while HB_UTF8LEN( cText ) > nLen
         cText    := HB_UTF8LEFT( cText, HB_UTF8LEN( cText ) - 1 )
      enddo
   
   endif

return PadR( cText, LEN(cText) - HB_UTF8LEN( cText ) + nLen )

/*
function FW_UTF8PADR( cText, nLen )

   cText    := Trim( cText )
   if IsUtf8( cText )
      do while Len( cText ) > nLen
         cText    := HB_UTF8LEFT( cText, HB_UTF8LEN( cText ) - 1 )
      enddo
   
   endif

return PadR( cText, nLen )
*/

Thank you in advance.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ๊TGET problem with FW_SetUnicode(.T.)
Posted: Fri Jul 01, 2016 09:22 AM

Get restricts entry by number of bytes.
You can enter as much unicode text as can fit into the number of bytes of the string.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion