I can scale up a textfield in Maxscript and it will become a multiline textfield - my problem: it gets no scrollbar when the text is longer than the textfield.
Question:
1. How i can add scroll bars to the 3ds max textfield
2. OR: how i use a dotnet textbox?
Replies
To comment what's happening in there:
dotNetControl dncText "System.Windows.Forms.Textbox" -- this is how you declare the dotnet textbox in case you're using it in regular maxscript rollout; you can as well just say dotNetControl dncText "Textbox"
dncText.Font -- if you don't like the default one
dncText.BorderStyle -- I guess you can say what this is; anytime you need to find out more about the properties/methods/events of the control, you can create one and query it:
showproperties (dotNetObject "TextBox")
showmethods (dotNetObject "TextBox")
showevents (dotNetObject "TextBox") -- this is useful for assigning event handlers, you can then just say on MouseDoubleClick args dncText do ...
It also gives you the classes/objects you need to assign to the property to change it. However with the properties there's a shorthand possibility:
instead of:
dncText.ScrollBars = (dotNetClass "System.Windows.Forms.ScrollBars").Vertical
you can just say:
dncText.ScrollBars = dncText.ScrollBars.Vertical
The backcolor assignment I use there gets the interface colors, that's why it might look so intimidating. In fact it could be just
dncText.BackColor = dncText.BackColor.fromARGB 140 150 160
or something like that. Anyway, there're quite many tutorials around (Paul Neale comes to mind) dealing with donet so even if this doesn't completely make sense, don't worry, ask for details or just search around for ready made scripts using it and you'll master it in no time.
my code:
But it does nothing. I'm not able to make a linebreak.
.AcceptsReturn: Enter doesn't work, Strg+Enter doesn't work
.AcceptsTab: Enter doesn't work, Strg+Enter works
1. I had to set AcceptsReturn AND AcceptsTab to true. Only *Return didn't worked
2. I had to check if Enter was pressed and paste a line break manually