Hi! I need help with this.
I've created my routines in VB.NET obviously with a lot help from this forum, I mean following a lot of post, even I've created my panel ribbon and so far so good.
But now I would like to learn how to interact (enable) my ribbon button with my routine, because my ribbon button doesn't work for it. I was looking information about it, and I saw that I must use xlm code, and really I don't how to do it, because all information that I found is about C# code and my knowlege is about VB.NET
really I'll apreciate all help about it
Solved! Go to Solution.
Sorry for the delay.
Can you please explain what you mean by
"how to interact (enable) my ribbon button with my routine, because my ribbon button doesn't work for it"
If you can share some sample code that you have along with screenshots to explain what you are trying, that will help.
If you want to show / hide the ribbon panels, this blog post can provide a sample code :
Hi! Thanks for answer.
I created my routine in VB.NET
'This is my command and through of this I load a form
Dim frm AsNewfrmImportPoints
Dim Result AsDialogResult = Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(frm)
I can load it without problems in AutoCAD and It works. As you can see it in the picture Captura1.
Later I have the next code to create the control ribbon:
PublicSub Initialize() ImplementsIExtensionApplication.Initialize
PublicSub Terminate() ImplementsIExtensionApplication.Terminate
Dim RibCtrl AsRibbonControl = ComponentManager.Ribbon
Dim RibTab AsNewRibbonTab()
RibTab.Title = "IBAD_2014"
RibTab.Id = "IBAD_2014"
RibTab.IsActive = True
PrivateSub AddContent(ByVal RibTab AsRibbonTab)
Dim RibSourcePanel AsRibbonPanelSource = NewRibbonPanelSource()
RibSourcePanel.Title = "Herramientas"
Dim RibPanel AsNewRibbonPanel()
RibPanel.Source = RibSourcePanel
Dim ribToolTip AsRibbonToolTip = NewRibbonToolTip
ribToolTip.Title = "My Title"
ribToolTip.Content = "My Content"
ribToolTip.ExpandedContent = "my Expanded Content !"
ribToolTip.IsHelpEnabled = False
'Boton Ribbon para el dibujo de los PUNTOS
Dim RibBtnPoints AsRibbonButton = NewRibbonButton()
RibBtnPoints.Text = "DIBUJAR PUNTOS"
RibBtnPoints.CommandParameter = "PUNTOS"
RibBtnPoints.ShowText = True
RibBtnPoints.LargeImage = LoadImage(My.Resources.Resource1.In_Point_32px)
RibBtnPoints.Orientation = Windows.Controls.Orientation.Vertical
RibBtnPoints.ShowImage = True
RibBtnPoints.Size = RibbonItemSize.Large
RibBtnPoints.CommandHandler = NewAdskCommandHandler()
RibBtnPoints.IsToolTipEnabled = True
RibBtnPoints.ToolTip = ribToolTip
'Botón Ribbon para el dibujo del PERFIL LONGITUDINAL
Dim RibBtnPerfil AsRibbonButton = NewRibbonButton()
RibBtnPerfil.Text = "DIBUJAR PERFIL"
RibBtnPerfil.CommandParameter = "PERFILES"
RibBtnPerfil.ShowText = True
RibBtnPerfil.LargeImage = LoadImage(My.Resources.Resource1.Profile_32px)
RibBtnPerfil.Orientation = Windows.Controls.Orientation.Vertical
RibBtnPerfil.ShowImage = True
RibBtnPerfil.Size = RibbonItemSize.Large
RibBtnPerfil.CommandHandler = NewAdskCommandHandler()
'Botón Ribbon para extraer attributos de los BLOQUES y exportarlos EXCEL
Dim RibBtnExport AsRibbonButton = NewRibbonButton()
RibBtnExport.Text = "EXPORTAR ATRIBUTOS"
RibBtnExport.CommandParameter = "EXPORTAR_ATT"
RibBtnExport.ShowText = True
RibBtnExport.LargeImage = LoadImage(My.Resources.Resource1.Out_Point_32px)
RibBtnExport.Orientation = Windows.Controls.Orientation.Vertical
RibBtnExport.ShowImage = True
RibBtnExport.Size = RibbonItemSize.Large
RibBtnExport.CommandHandler = NewAdskCommandHandler()
PublicFunction CanExecute(parameter AsObject) AsBooleanImplements Windows.Input.ICommand.CanExecute
PublicEvent CanExecuteChanged(sender AsObject, e AsEventArgs) Implements Windows.Input.ICommand.CanExecuteChanged
PublicSub Execute(parameter AsObject) Implements Windows.Input.ICommand.Execute
Dim RibBtn AsRibbonButton = TryCast(parameter, RibbonButton)
If RibBtn IsNotNothingThen
SendStringToExecute(RibBtn.CommandParameter, True, False, True)
And so far so good, because appear the ribbon in AutoCAD. As you can see it in the picture Captura2.
And my problem is in this part. When I click in the button doesn't work I mean doesn't load my form, It just appear in the command line the name of my command "PUNTOS". As you can see it in the picture Capture3.
I was reading a lot about it and I couldn't find some solution, I guess I should learn something about XAML, and really I don't have experience with it.
I would appreciate any help about it. Thanks.
try adding <space> or ";" or <enter> to the command
RibBtnPoints.CommandParameter = "PUNTOS "
RibBtnPoints.CommandParameter = "PUNTOS;"
RibBtnPoints.CommandParameter = "PUNTOS" + vbCR
Look in youre CUI, the LINE command below contains a extra <space>