aelyo-softworks / Wice

Windows Interface Composition Engine is a .NET C# UI engine for creating Windows application.
Other
107 stars 5 forks source link

how to select text in TextBox by mouse left button #7

Closed Charltsing closed 8 months ago

Charltsing commented 8 months ago

i set IsEditable = true , it can select text by keyboard, but can not select by mouse left button

how to select text in TextBox by mouse left button

can not select by mouse.zip

smourier commented 8 months ago

It's not currently supported by RichTextBox, but should work fine with TextBox by mouse and keyboard:

image

Maybe you have no SelectionBrush or by default it's transparent (but in this case it shouldn't work by keyboard...)

Charltsing commented 8 months ago

it is my demo project (vs2022), with lastest wice source

do you try it ?

can not select by mouse (2).zip WiceDemo.zip

smourier commented 8 months ago

The issue was caused by your code using WindowsFunctions.EnableMouseInPointer() which calls this Windows API https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enablemouseinpointer that asks Windows to send WM_POINTERmessages instead of WM_MOUSEmessages.

Using the pointer instead of mouse wasn't fully supported. I have enhanced Wice (https://github.com/aelyo-softworks/Wice/commit/1ed33cb14b75bc077e518729473cae33f76504ee) and it should work better now.

The gallery also now allows to set it manually if unset at startup (it cannot be unset once set):

image

Charltsing commented 8 months ago

thanks a lot, it works fine.