alternetsoft / AlternetUI

MIT License
22 stars 2 forks source link

Help to convert Winforms to AlternetUI #89

Closed neoxeo closed 6 months ago

neoxeo commented 6 months ago

@generalloki

Is there equivalent to : WndProc(ref Message m) SendKeys.Send("^v"); TextBox1.SelectionStart TextBox1.SelectionLength Screen Screen.AllScreens Graphics.CopyFromScreen

How to update text in _mForm1.TextBox.Text from an "external" class ?

Thanks

generalloki commented 6 months ago

WndProc(ref Message m) - No, it's not crossplatform. What for? We need to speak about each individual situation here.

Graphics.CopyFromScreen - No. I beleive this is unsecure.

TextBox1.SelectionStart, TextBox1.SelectionLength. There is GetSelectionStart(), GetSelectionEnd(). But I beleive there should be SelectionStart, SelectionLength. I will add these.

Screen - We have it, called Display. But probably Screen also need to be added. Screen.AllScreens - it is possible to implement it with Display.

SendKeys.Send("^v"); - I beleive it's possible to implement but we need to investigate this.

neoxeo commented 6 months ago

@generalloki

Thanks a lot to have taken time to answer. It's clear for me.

Have a good day !

neoxeo commented 6 months ago

@generalloki

And for this question please : How to update text in other window like _mForm1.TextBox.Text from an "external" class ?

generalloki commented 6 months ago

add property

public string TextBoxText
{ 
get => textBox.Text;
set => textBox.Text = value; 
}

or even:

public TextBox TextBox
{ 
get => textBox;
}
neoxeo commented 6 months ago

@generalloki

When I see your answer, I'm ashamed to have asked the question, sorry.

Thanks.

neoxeo commented 6 months ago

Replace by issues 94, 95 and 96

neoxeo commented 6 months ago

Graphics.CopyFromScreen

@generalloki

I don't understand why you thougth Graphics.CopyFromScreen is unsecure. It is present in standard .Net8.0 and this is not a problem. If someone want to use this to "steal" data he will be able to do that. https://learn.microsoft.com/fr-fr/dotnet/api/system.drawing.graphics.copyfromscreen?view=dotnet-plat-ext-8.0

generalloki commented 6 months ago

There is wxScreenDC in wxWidgets so we could try to add Graphics.CopyFromScreen. https://docs.wxwidgets.org/3.2/classwx_screen_d_c.html By "unsecure" I meant that in new Ubuntu window manager even top window positioning is not possible. So I thought here we potentially can have troubles (it could be unsupported). Anyway I add this as separate issue #113.

neoxeo commented 6 months ago

Thank you for these informations. Now, I understand why you speak about "unsecure". Thanks