PDA

View Full Version : .NET try to get focus on forms.WebBrowser


ricozone
04-01-2010, 01:12 PM
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.

pela134
04-01-2010, 04:16 PM
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()
)

ricozone
04-06-2010, 08:26 AM
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.

CGTalk Moderation
04-06-2010, 08:26 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.