Ok, this one was done in VB.NET. Just start a new controls project and have
a class and a user control. The code for the class is below. For the
usercontrol, just add a textbox, a button, and a FolderBrowserDialog
control. The pertinent code here is for the button:
Private Sub BrowseButtons_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBrowse1.Click, btnBrowse2.Click
'System.Windows.Forms.MessageBox.Show("?")
Me.FolderBrowserDialog1.Description = "Select the folder..."
If Me.FolderBrowserDialog1.ShowDialog(Me.ParentForm) = DialogResult.OK
Then
Select Case sender.name.toupper
Case Is = "BTNBROWSE1" 'browse for drawings
Me.txtDwgPath.Text = Me.FolderBrowserDialog1.SelectedPath
Case Is = "BTNBROWSE2" 'browse for blocks
Me.txtBlkPath.Text = Me.FolderBrowserDialog1.SelectedPath
End Select
End If
End Sub
For the FolderBrowserDialog to "show" all you should need is a call to ME
...ShowDialog(Me) or ShowDialog(Me.ParentForm). This works fine if you
restrict 2006 to using 1.1.4322. If you remove this restriction from the
acad.exe.config file and run with 2.0, the same code fails to display the
FolderBrowserDialog.
CLASS CODE:
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Windows
Public Class OGIDefaults
Implements Autodesk.AutoCAD.Runtime.IExtensionApplication
Private Shared myCtrl As TabExtension
Public Sub Initialize() Implements
Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize
'fire up the toolpalette set
Try
'Enable XP
System.Windows.Forms.Application.EnableVisualStyles()
StartInterface()
Catch ex As System.Exception
Console.WriteLine(ex)
End Try
End Sub
Public Sub Terminate() Implements
Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate
'handle user closing toolpalette set
myCtrl.Dispose()
End Sub
_
Public Shared Sub StartInterface()
AddHandler
Autodesk.AutoCAD.ApplicationServices.Application.DisplayingOptionDialog,
AddressOf Application_TabbedDialog
AddHandler
Autodesk.AutoCAD.ApplicationServices.Application.DisplayingDraftingSettingsDialog,
AddressOf Application_TabbedDialog
AddHandler
Autodesk.AutoCAD.ApplicationServices.Application.DisplayingCustomizeDialog,
AddressOf Application_TabbedDialog
End Sub
Private Shared Sub Application_TabbedDialog(ByVal sender As Object, ByVal
e As Autodesk.AutoCAD.ApplicationServices.TabbedDialogEventArgs)
myCtrl = New TabExtension
e.AddTab("Ohio Gratings", New
Autodesk.AutoCAD.ApplicationServices.TabbedDialogExtension(myCtrl, _
New Autodesk.AutoCAD.ApplicationServices.TabbedDialogAction(AddressOf
myCtrl.OnOk), _
New Autodesk.AutoCAD.ApplicationServices.TabbedDialogAction(AddressOf
myCtrl.OnCancel), _
New Autodesk.AutoCAD.ApplicationServices.TabbedDialogAction(AddressOf
myCtrl.OnHelp) _
) _
)
End Sub
End Class
-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon...