Notifications
Clear all

[Closed] dotnet editText example for maxscript

Does anyone know where there is a sample of dotnet editText example for maxscript. My UI is mostly all dotnet and the maxscript editText does not fit the UI style.

Thanks

4 Replies

I found some …


FONTSTYLE = dotnetclass "System.Drawing.FontStyle"
TextBox = dotNetObject "System.Windows.Forms.TextBox"
TextBox.Location = dotNetObject "System.Drawing.Point" 3 10
TextBox.Width = 200
TextBox.Height = 12
TextBox.Visible = true
TextBox.MultiLine = false
TextBox.enabled = true
TextBox.ForeColor = (dotnetclass "System.Drawing.Color").FromArgb 20 20 20
TextBox.BackColor = (dotnetclass "System.Drawing.Color").FromArgb 120 120 120
TextBox.Text = "Viewport Display"
TextBox.Font = dotnetobject "System.Drawing.Font" "Arial" 8 FONTSTYLE.italic  

-- Create Form
Form = dotNetObject "System.Windows.Forms.Form"
Form.Size = dotNetObject "System.Drawing.Size" 310 335
Form.Text = ".Net 2.0 Form with TextBox"
Form.Controls.Add(TextBox)
Form.TopMost = true
FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
Form.FormBorderStyle = FormBorderStyle.FixedDialog
Form.ShowInTaskbar = false
Form.MinimizeBox = false
Form.MaximizeBox = false

-- Set appropriate Form background color
maxBackColor = colorMan.getColor #background
Form.BackColor = (dotnetclass "System.Drawing.Color").FromArgb 50 50 50

-- Show application Form
hApp = dotNetClass "System.Windows.Forms.Application"
hApp.Run Form

not too sure about what it wants on style

TextBox.BorderStyle = ?

or on entered

on TextBox Click argg do (
showProps TextBox
)

TextBox.BorderStyle = ?

blind i would say…

borderstyle= dotnetclass "System.Windows.Forms.BorderStyle"
 TextBox.BorderStyle = borderstyle.Fixed3D
 TextBox.BorderStyle = borderstyle.FixedSingle
 TextBox.BorderStyle = borderstyle.None

the ref is quite comprehensive btw (not being autodesk like)

That link was great.


clearlistener()
try(destroyDialog MyForm)catch()

Global FONTSTYLE = dotnetclass "System.Drawing.FontStyle"
Global TITLEFONT = dotnetobject "System.Drawing.Font" "Arial" 8 FONTSTYLE.italic  ---FontStyle.regular FontStyle.bold FontStyle.italic FontStyle.underline FontStyle.strikeou
Global MESSAGEFONT = dotnetobject "System.Drawing.Font" "Arial" 8 FONTSTYLE.italic  ---FontStyle.regular FontStyle.bold FontStyle.italic FontStyle.underline FontStyle.strikeout

fn showProps obj = (
	clearListener()
	format "Properties:
"
	showProperties obj
	format "
Methods:
"
	showMethods obj
	format "
Events:
"
	showEvents obj
)

rollout MyForm "MyForm" width:300 height:400(
	dotNetControl TextBox "System.Windows.Forms.TextBox" width:200 height:16

	on MyForm open do(
		TextBox.Visible = true
		TextBox.MultiLine = false
		TextBox.enabled = true
		TextBox.ForeColor = (dotnetclass "System.Drawing.Color").FromArgb 20 20 20
		TextBox.BackColor = (dotnetclass "System.Drawing.Color").FromArgb 180 180 180
		TextBox.BorderStyle = (dotNetClass "System.Windows.Forms.BorderStyle").FixedSingle
		TextBox.Text = "Hello world"
		TextBox.Font = TITLEFONT
		TextBox.DeselectAll()
		showProps TextBox
	)
	
	on TextBox keydown pressedKey do ( --- this works great
		print pressedKey.keyvalue
	)
	
	on TextBox Enter state  do (  ---- not working
		showProps TextBox
	)
	
	on TextBox mouseDown arg do( --- works great too
		TextBox.clear()
	)	
)
createdialog MyForm

the clear() is nice on ender textbox