PDA

View Full Version : Dotnet VisualBasic Form Reader


Kameleon
04-21-2008, 07:08 PM
Hi guys, today I've started another not yet so simple script that was in my mind awhile ago, since Max doesnt have a visual editor for dotnet controls, it would be cool to create them using VB Express or something (but since I use VB Express... :P) and them have that form imported into Max, that's what I did, in a simple way, it only works with some controls at the moment and not all properties work, but that's a wip and with time it can be refined. Anyway, for simpler stuff, I guess this is good start and it allows to make nice UI's without having the headache of System.Points bla bla :)


The controls are added to an array, the control names are the same defined in VB so it's easy to use them. Hope you like it!

PS- I've attached a .Designer.vb file just to serve as an example, if you want to create your own, simply save a form in VB and then redirect this line in the script to your own file:
ffile=openFile "frm_main.Designer.vb" mode:"r"

Kameleon
04-23-2008, 05:07 PM
Hi guys, today I added more support for the simpler controls (I think almost everything is working, regarding text boxes, buttons and so on). I've added the possibility to create the items in a listbox/combobox/etc in VB and have them imported perfectly into Max :D I also added support for Tabs (although someting is weird with the interface color, but it seems to be a bug from the control), support for WebBrowser control, checkboxes, listed checkboxes, richttextbox :P I admit I'm having fun creating the UI's in VB and having them nicely recreated in Max without any trouble, hope you have fun also :) Cya!

LoneRobot
04-24-2008, 08:29 AM
Hello Artur,

Well done and thank you. I will be sure to give this a try since most of the time i have VS and max open side by side! :beer:

Kameleon
04-24-2008, 08:46 AM
Thanks LoneRobot, I hope it fits your needs, I've done some changing last night, I've defined a struct and now it's easier to include that file in another script, I'll upload it here. Just include the file in your script and then load your form this way:

dform=dotnetform()
dform.Load("frm_main.Designer.vb")
dform.Show()

I've also created a function to return a control, just do:

myobj=dform.getobj "btn_ok"

Here's an example I've made (actually I just ported a script I already did, to this form reading method, it saved me lot of code lines! who would have guessed! hehe):


(
include "vb_form_reader_v3.ms"

dform=dotnetform()
dform.Load("VB\frm_main.Designer.vb")

fn btn_ok_Click =
(
myobj=dform.getobj "lst_layers"
if myobj.selecteditem==undefined then return
layer=undefined
for i=0 to myobj.Items.Count-1 do
(
issel=myobj.GetSelected i
if issel then
(
layer=layerManager.getLayer i
layer.nodes &arr_nodes
for i in arr_nodes do unhide i
)
)
)
fn frm_main_Load =
(
myobj=dform.getobj "lst_layers"
for i=0 to LayerManager.count-1 do
(
layer=LayerManager.getLayer i
myobj.Items.Insert i (dotnetobject "System.String" layer.name)
)
)
myobj=dform.getobj "btn_ok"
dotnet.addEventHandler myobj "Click" btn_ok_Click
myobj=undefined
myform=dform.dforms[1]
dotnet.addEventHandler myform "Load" frm_main_Load
myform=undefined

dform.Show()
)

Kameleon
04-24-2008, 05:52 PM
Hi! More updates on this one! I've solved a problem regarding the DotNet Form that was annoying to say the least, also spend the afternoon adding support for the DataGridView and almost all it's column modes, except for the Image one, Combo, Button and Check are fully functional, you can even save items in VB in the Combo one as they will be loaded into Max :D This one was for Koichi! Hehe

The other control I've added was the MenuStrip and corresponding ToolstripItems, so you can create all the menus in VB :D Oh, Panels are now supported, docking controls also works.

I've included a .Designer.vb file with almost all controls supported. Hope you guys like it!

CGTalk Moderation
04-24-2008, 05:52 PM
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.