PDA

View Full Version : Docs Question? eventhandler on DotNetControl, And WebBrowser clicks.


Vsai
08-29-2008, 03:30 AM
the docs say

dotNet Struct MethodsdotNet.addEventHandler()

This method adds an event handler to a dotNetControl



max says:

>> MAXScript Rollout Handler Exception: -- Unable to convert: dotNetControl:wb:System.Windows.Forms.WebBrowser to type: dotNetObject <<


I have a feeling the DotNetControl in the docs should read DotNetObject ;)

So.. Is it possible to add an event handler to a dotnetcontrol? I believe all dotnetcontrols enable the 'on Event arg do' syntax, but the click event for the webbrowser control doesn't work due to not being enabled at the framework level.

looking for a way around this still, i've poked into a few different things. this is one of the few articles i've found about this problem with an actual solution, but i'm truthfully not too sure how to translate this to a maxscript acceptible format: http://ryanfarley.com/blog/archive/2004/12/27/1334.aspx

ofer_z
08-29-2008, 09:47 AM
I have a feeling the DotNetControl in the docs should read DotNetObject ;)

So.. Is it possible to add an event handler to a dotnetcontrol? I believe all dotnetcontrols enable the 'on Event arg do' syntax,


I think you're right about that. Perhaps bobo can give a definite answer.


Is this what you're trying to get:

try(destroyDialog ro_test)catch()

rollout ro_test "test"
(
dotNetControl browser "WebBrowser" height:300 width:300 pos:[0,0]

-- The onClick function
fn onClick sender args =
(
print "Document on click"
)

-- Check the page load progress and register the click callback to the document object
on browser ProgressChanged args do (
if args.CurrentProgress == args.MaximumProgress then (
dotNet.removeEventHandler browser.Document #Click onclick
dotNet.addEventHandler browser.Document #Click onclick
)
)

on ro_test open do (
browser.Navigate "www.google.com"
)
)

createDialog ro_test 300 300



hOpe this helps,
o

Vsai
08-29-2008, 11:40 AM
well I'll be! Thanks. I kept trying to add it to the browser, not the document :)

CGTalk Moderation
08-29-2008, 11:40 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.