StyledText not accept Multi-bytes characters

Frank Benoit keinfarbton at googlemail.com
Thu Aug 21 00:59:31 PDT 2008


yidabu schrieb:
> program crashed when StyledText.text encounter multi-bytes characters, e.g. Chinese.
> 
> code below causes EXCEPTION_ACCESS_VIOLATION :
> Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at ntdll.dll (0x7c90316c) thread(1260)
> ->us
> #0 ?? () from ntdll.dll
> 
> Code:
> 
> import dwt.DWT;
> import dwt.custom.StyledText;
> import dwt.custom.StyleRange;
> import dwt.layout.FillLayout;
> import dwt.widgets.Display;
> import dwt.widgets.Shell;
> import dwt.widgets.Listener;
> import dwt.widgets.Event;
> import dwt.graphics.Color;
> import dwt.graphics.Point;
> 
> import dwt.dwthelper.utils;
> 
> void main() {
>     static String SEARCH_STRING = "box";
>     Display display = new Display();
>     Color RED = display.getSystemColor(DWT.COLOR_RED);
>     Shell shell = new Shell(display);
>     shell.setBounds(10,10,250,250);
>     StyledText text = new StyledText(shell, DWT.NONE);
>     text.setBounds(10,10,200,200);
>     text.setText("StyledText not accept Chinese 中国? ");
>     shell.open();
>     while (!shell.isDisposed()) {
>         if (!display.readAndDispatch()) display.sleep();
>     }
>     display.dispose();
> }
> 
> 
> 
> 

I did some changes to TextLayout.
Your example works now. More testing welcome.


More information about the Digitalmars-d-dwt mailing list