๊TGET problem with FW_SetUnicode(.T.)

๊TGET problem with FW_SetUnicode(.T.)

Postby dutch » 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: Select all  Expand view
#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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: ๊TGET problem with FW_SetUnicode(.T.)

Postby dutch » Wed Jun 29, 2016 1: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: Select all  Expand view
#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: Select all  Expand view
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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: ๊TGET problem with FW_SetUnicode(.T.)

Postby nageswaragunupudi » Fri Jul 01, 2016 9: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests