.net control WebBrowser, need help with something

.net control WebBrowser, need help with something

Anonymous
Not applicable
324 Views
4 Replies
Message 1 of 5

.net control WebBrowser, need help with something

Anonymous
Not applicable
Hello,

I'm attempting to integrate a System.Windows.forms.WebBrowser control into a script that will allow for data entry and I'm having a problem where the Enter and Tab keys don't do anything.

I've just started to delve into .net controls within Maxscript and I'm thoroughly confused as to what I might be missing here. I've simply copied and pasted the example code provided in the Max help docs (sorry for removing the K&R bracketting Bobo) and have included a website with a Rich Text editor for testing. If you simply copy/paste and evaluate the following code you'll find that a website loads with a multi-line text control, you can type into the box with no problems, however, the Enter key and Tab do absolutely nothing, does anyone have any ideas?

-Jon


rollout webbrowser_rollout "Web Test" width:600 height:600
(
edittext edt_url "URL:" text:"http://www.kevinroth.com/rte/demo.php"
dotNetControl wb "System.Windows.forms.WebBrowser" pos: width:580 height:570

fn openURL urlString =
(
wb.url = dotNetObject "System.Uri" urlString
)
on edt_url entered txt do openURL txt
on webbrowser_rollout open do openURL edt_url.text

)
createdialog webbrowser_rollout
0 Likes
325 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
If you are under Max 2008 or higher you should try to use a MaxForm:

(
-- Load MaxCustomControls assembly
-- This assembly contains UI components built on the .NET Framework for use in 3ds Max
dotNet.loadAssembly "MaxCustomControls.dll"

-- Create WebBrowser
webBrowser = dotNetObject "System.Windows.forms.WebBrowser"
webBrowser.Location = dotNetObject "System.Drawing.Point" 10 10
webBrowser.Width = 570
webBrowser.Height = 540
webBrowser.Url = dotNetObject "System.Uri" "http://www.kevinroth.com/rte/demo.php"

-- Create Max Form
maxForm = dotNetObject "MaxCustomControls.MaxForm"
maxForm.Size = dotNetObject "System.Drawing.Size" 600 600
maxForm.Text = "Max Form with WebBrowser"
maxForm.Controls.Add(webBrowser)
maxForm.TopMost = true
FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
maxForm.FormBorderStyle = FormBorderStyle.FixedDialog
maxForm.ShowInTaskbar = false
maxForm.MinimizeBox = false
maxForm.MaximizeBox = false

-- Show MaxForm
maxForm.ShowModeless()
)
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thank you very much for the reply and the sample code Yannick. I didn't realize there was a custom MaxForm for such a purpose. I just searched the MaxScript documentation and couldn't find any reference to it, is there any source for information on this?

Thanks again,

Jon Adkins
0 Likes
Message 4 of 5

Anonymous
Not applicable
It's only documented in the SDK Reference (3ds Max .NET SDK). In fact there are others controls and utils in these assemblies. This .NET SDK was created for use in plugins but MaxForm is very useful in MAXScript.
0 Likes
Message 5 of 5

Anonymous
Not applicable
Awesome, thanks again.
0 Likes