How to create a dialog using VB.NET?

How to create a dialog using VB.NET?

Anonymous
Not applicable
1,076 Views
5 Replies
Message 1 of 6

How to create a dialog using VB.NET?

Anonymous
Not applicable

Using VB.NET, I need to add a dialog in Revit, but it seems to be a bit problematic.
I have tried to study a C # project created in REX expansion wizard, but I can not figure out how exactly the dialogue is implemented and embedded in Revit.

I can find many examples of the use of a task-dialogue, but that is not the kind of dialogue that I need.

What I need is a dialog box that contains some text boxes, combo boxes, etc. and blends nicely into the Revit user interface.

Does anyone have an example of that?

 

regards

Jan grenov

 

0 Likes
Accepted solutions (2)
1,077 Views
5 Replies
Replies (5)
Message 2 of 6

augusto.goncalves
Alumni
Alumni

To use Forms inside Revit you just need to create a 'classic' WinForm, and there are several samples of that on the web.

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks Augusto

I guess that I might have posted my question unpecisely. My fault. Sorry!

 

I will try to be a little more precise .. 

  1. I have done the "Hello world" a long! time ago, and I know how to make a form in VB!
  2. I just thought that there migth be some elegant way of implementing forms in Revit so that I do not need to check the WinForms Topmost property.
    Similar as in AutoCAD:
    Dim dia As New someDialog(FormOpener.AutoCAD)

    Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(dia)

I want my form to be hidden when the Revit window is hidden. Not to show as if it was an an independant application. Must I somehow refer to the Revit hwnd or have I missed something basic?

 

Regards

Jan Grenov

 

0 Likes
Message 4 of 6

PhillipM
Advocate
Advocate
Accepted solution

Ok.

 

You want to show a dockable dialog that belongs to Revit.  Two options.

 

  1. Revit 2015 - & 2014.  Using the dockableDialog interface.  There is a good example of that working in the SDK called DocakableDialogs.  You will actually be using WPF forms for this unless you host a Win Form inside of a WPF form.
  2. Pre Revit 2014.  AS you suggest using Revit hwnd and there is examples of that on Jeremy's Building COder blog i'm pretty sure.

Regards

Phillip

0 Likes
Message 5 of 6

jeremy_tammik
Alumni
Alumni
Accepted solution

Dear Jan,

 

Yes, you were indeed imprecise  🙂

 

Yet, rejoice!

 

Salvation is nigh!

 

Google for "JtWindowHandle":

 

http://lmgtfy.com/?q=revit+api+JtWindowHandle

 

Cheers,

 

Jeremy

 

p.s. Phillip's answer is very valuable. If you can use a hosted palette, that is much more elegant and integrated. Thank you, Phillip!

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 6

Anonymous
Not applicable
Thanks Guys 🙂
I think that I will look a little more into those "hosted palettes". Sounds as an interesting solution.

Regards
Jan
0 Likes