[Closed] .NET try to get focus on forms.WebBrowser
Hi,
i’m having a problem to find the way to get the focus in webbrowser form.
With “enableAccelerators = false”, the focus is on the webBrowser but i can’t find an event that works to fire this “enableAccelerators = false” after loosing focus.
For example :
rollout test "Test"
(
dotNetControl wb "system.windows.forms.webbrowser" height:480
on test open do
(
enableAccelerators = false
wb.url = dotNetObject "System.Uri" "http://www.cgsociety.org"
)
on wb Click arg do (
enableAccelerators = false -- enable focus on webbrowser
print ("enableAccelerators: " + enableAccelerators as string)
)
)
createDialog test 600 500
With this snippet, if you go to the login input field of “cgsociety.org”, at first you can type text in it.
Now click on max’s viewport (loosing focus) and return to the webbrowser, try to type any text in input field…not possible.
Why the event “on click” does not work ?
Thanks for your help.
I don’t think the “on wb Click arg do” event handler is possible on a dotnet control. Try something like this instead: (using dotNet.addEventHandler)
fn onWbGotFocus a b =
(
enableAccelerators = false -- enable focus on webbrowser
print ("enableAccelerators: " + enableAccelerators as string)
)
(
wb = dotNetObject "system.windows.forms.webbrowser"
wb.url = dotNetObject "System.Uri" "http://www.cgsociety.org"
-- showevents wb
--Create a DotNet Form
hForm = dotNetObject "System.Windows.Forms.Form"
hForm.controls.add wb
hForm.topmost = true
dotNet.addEventHandler wb "GotFocus" onWbGotFocus
hForm.show()
)
Hi Peter,
this sounds very good.
Now I just have to put this form in a rollout to work fine on my project.
Thanks again for the help.