Accessing command buttons on a panel from elsewhere (rhinocommon)

I have a panel with some buttons on it. I would like to be able to enable or disable these buttons. I can do this from other buttons on the panel, but if I want to do this from elsewhere, say from a command, how do I do it? My first feable attempt was something like:
MyPanel.MyButton.enabled = false
But this isn’t any good. I did see the earlier post asking the same question I think (accessing and working with user control panels), but still stuck.

Thanks,
Sam

I think you need a work around.

You need to check when a command ends.
Check which command id was used.

  • In your command update a shared variable.
  • When the command is finished. Check the end command handler within your panel.
  • update panel

I use this when I change an object height.

AddHandler Rhino.Commands.Command.EndCommand, AddressOf EndOfCommand

Private Sub EndOfCommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)
'What to do within your panel
End Sub

Btw. To be sure you only run the update when you want. Compare the I’d of your command with the current command to faster up things

And use the addhandler on panel load

Got it, thanks for the quick response!

Sam

No problem. Great I could help :slight_smile: