iced icon indicating copy to clipboard operation
iced copied to clipboard

text_input can't accept chinese input

Open ys928 opened this issue 3 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Is this issue related to iced?

  • [X] My hardware is compatible and my graphics drivers are up-to-date.

What happened?

the text_input Can display Chinese,but when app run,I can't change to input chinese

config:

[dependencies]
iced ='0.9.0'
iced_lazy= '0.6.0'
iced_native ='0.10.0'

and the main code:

    App::run(
        Settings{
            window:window::Settings{
                size:(800,600),
                ..Default::default()
            },
            default_font:Some(include_bytes!("STXINGKA.TTF")),  //设置中文的.ttf字体
            ..Default::default()
        })


      text_input("请输入",&self.inpur_txt)
          .id(text_input::Id::new("1-input"))
          .on_input(Message::EditInput)
          .on_submit(Message::EditCmt)
          .width(180)
          .size(25)
      ,

What is the expected behavior?

when I Press shift key, I should Switch to Chinese input,but it didn‘t

when I use other app,it's normal, such as vscode

Version

master

Operative System

Windows

Do you have any log output?

No response

ys928 avatar Apr 20 '23 04:04 ys928

In fact, the example todos cannot switch the input method to Chinese either in my computer

ys928 avatar Apr 20 '23 04:04 ys928

https://github.com/iced-rs/iced/pull/1474

jinliming2 avatar Apr 21 '23 12:04 jinliming2

emm , I hava tested the example : https://github.com/t18b219k/iced_text_input_sample/

yeal,that's work well,but it's version seem too old.

in 0.9.0 version, the text_input can't work well,I don't know how to fix it

ys928 avatar Apr 21 '23 13:04 ys928

emm , I hava tested the example : https://github.com/t18b219k/iced_text_input_sample/

yeal,that's work well,but it's version seem too old.

in 0.9.0 version, the text_input can't work well,I don't know how to fix it

Change method main:

Todos::run(Settings {
    default_font: Some(include_bytes!("../assets/font/STSong.ttf")),
)}

Add this line works well for me. Tips: the STSong.ttf can be downloaded from elsewhere.

myan9527 avatar Jul 20 '23 01:07 myan9527

@ys928 你这个问题解决了吗,我也遇到这个问题,UI可以显示中文,text_input可以粘贴中文,但是无法切换中文输入法,无法直接输入中文

rongjv avatar Nov 23 '23 07:11 rongjv

@rongjv 你用这个PR试试 #1858

tingfeng-key avatar Nov 23 '23 10:11 tingfeng-key

@rongjv 你用这个PR试试 #1858

你好,感谢,我还想问下,PR是什么意思,还有怎么单独使用某个PR,我是vscode上,iced在toml的依赖里设置后,所有模块都是它自己下载的

rongjv avatar Nov 23 '23 10:11 rongjv

@rongjv 你用这个PR试试 #1858

谢谢,我已经试过了,的确可行,不过稍微有点小问题,就是鼠标在文本框点击后,有时候输入法还是会丢失,需要再点击文本框一次,输入法又回来了。但还是谢谢你的回答

rongjv avatar Nov 23 '23 15:11 rongjv