Author Topic: Creating ribbons for AutoCAD  (Read 9107 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Creating ribbons for AutoCAD
« Reply #15 on: June 26, 2017, 05:08:50 PM »
I added the CurrentChanged event and experienced the same thing you talked about ... it doesn't fire if the currently selected object is clicked.
I had hoped for a solution similar to a layer combo, where you can select various items in the list and click on them, thus changing the property. I noticed that the layer combo doesn't allow you to click on the selected item, but the dropdown stays open even after a click. It disappears with a mouseleave event.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Creating ribbons for AutoCAD
« Reply #16 on: June 26, 2017, 11:39:41 PM »
I ran across an interesting error with regards to the button tag.
Because I need to monitor the state of the button, I am setting the tag to "ON" and when the button is clicked, I change the tag to "OFF". This way I can do different things in the event handler based on the previous state.

When I initially wrote the code, I got an error that I couldn't use "==" to compare Tag to "ON". The suggestion was to us "Is", thus the comparison would be:
button.Tag Is "ON"

I guess that's ok, but I wanted to be sure I was comparing correctly so I decided to use the ToString() method .. well, apparently AutoCAD doesn't like that.
button.Tag.ToString() == "ON" compiles just fine, but it throws a fatal error. Stepping through the code verified it.

Oh well ... I'll go back to the "IS" comparison.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2111
  • class keyThumper<T>:ILazy<T>
Re: Creating ribbons for AutoCAD
« Reply #17 on: June 27, 2017, 12:54:46 AM »
Would that be because the Tag returns an object
and comparing objects compares for the 'same"  referenced object address, not the content ??
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Creating ribbons for AutoCAD
« Reply #18 on: June 27, 2017, 05:36:21 PM »
Well, it would if I were comparing that is where the error was happening.
I am calling the ToString() method of Tag .. presumably it returns a string ... presumably you can compare strings ... apparently not.

Calling the ToString() method of the Tag object results in a fatal error in AutoCAD.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Keith Brown

  • Swamp Rat
  • Posts: 601
Re: Creating ribbons for AutoCAD
« Reply #19 on: June 27, 2017, 07:45:09 PM »
Instead of using the tostring method,  cast it to a string instead. 
Keith Brown | AutoCAD MEP Blog | RSS Feed
AutoCAD MEP 2014 / Revit MEP 2014 / EastCoast CAD/CAM addon / Visual Studio 2013

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Creating ribbons for AutoCAD
« Reply #20 on: June 27, 2017, 09:43:47 PM »
I'll try that and see if it makes a difference
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

BlackBox

  • King Gator
  • Posts: 3770
Re: Creating ribbons for AutoCAD
« Reply #21 on: June 28, 2017, 12:36:22 PM »
For the RibbonCombo the CurrentChanged event does NOT consider selecting the currently displayed item (either from the pull-down list or directly) should cause an event to fire.
I sort of agree with this when selecting the displayed item directly, but I think the event should fire if the item is selected from the drop-down.

This sounds like the same sort of behavior I observed and reported to Autodesk a few years ago (that still hasn't been fixed), which might suggest that the RibbonCombo and CUI Control component inherit the same Class design flaw.

Autodesk broke the Workspace control with the advent of QAT (in 2014 or earlier), and subsequently broke the Workspace 'gear' in systray in 2015 version, which I had used as a workaround for the former.  Prior to the breaking of the interface, one could select the current Workspace from the control drop down, and the Workspace would be restored. 

Now, the resultant behavior is that nothing happens at all (no events, Workspace is not restored, etc. without manually restoring using Command or WSCURRENT sysvar).



More information, for those with a Beta account:

BUG:0345 | Failure To Restore Workspace



Cheers
"How we think determines what we do, and what we do determines what we get."