Author Topic: How to display context ribbon  (Read 2492 times)

0 Members and 1 Guest are viewing this topic.

kenkrupa

  • Newt
  • Posts: 84
How to display context ribbon
« on: June 16, 2010, 11:17:35 AM »
When you do the MTEXT command (R2010), after picking the second corner a Text Editor ribbon is displayed.
With lisp, if you do
(initdia)(initcommandversion 2)(command "_mtext")(princ)
it works the same way.  BUT if that is part of a larger routine where it is followed by
(while (= (getvar "cmdactive") 1)(command pause))
and then other stuff, then the ribbon is not displayed.

So, what I'm looking for is a way to display that ribbon (and dismiss it afterward). Possible with lisp?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to display context ribbon
« Reply #1 on: June 16, 2010, 11:48:45 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

kenkrupa

  • Newt
  • Posts: 84
Re: How to display context ribbon
« Reply #2 on: June 16, 2010, 02:17:06 PM »
Check this out.
http://www.theswamp.org/index.php?topic=30407.msg360299#msg360299

Thanks for the reply CAB, but it does not seem to be on target. That topic is about the Mtext editor. I'm talking about a Text Editor ribbon (see attached image), which is displayed whenever the Mtext command is used (except in this program situation).

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: How to display context ribbon
« Reply #3 on: June 16, 2010, 02:29:21 PM »
Context depends on the selected object, so maybe its considering nothing to be selected.  Maybe a call involving (sssetfirst) or other means of keeping the mtext object selected would help?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

kenkrupa

  • Newt
  • Posts: 84
Re: How to display context ribbon
« Reply #4 on: June 16, 2010, 03:16:52 PM »
Context depends on the selected object, so maybe its considering nothing to be selected.  Maybe a call involving (sssetfirst) or other means of keeping the mtext object selected would help?

What? There is no mtext object yet, just the input box, when this ribbon displays.

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to display context ribbon
« Reply #5 on: June 16, 2010, 03:20:38 PM »
I wonder what you're trying to do?

First: initcommandversion should only be used if you want to use a special (old) version of a command. As far as I know command versioning is only available for the commands CHAMFER, FILLET, LAYOUT, LENGTHEN, TRIM, COLOR and EXPLODE. (I know there are more versions of the MTEXT command, but you can only change it to "OLDEDITOR" and I can't imagine you want to do that)
 
Second:
Code: [Select]
(while (= (getvar "cmdactive") 1)(command pause))can only be usefull before or after the MTEXT command, right?

This is how I would do it:
Code: [Select]
(defun c:test (/ th DM p1 rot)
 (setq th 3.5); textsize

 (command "._undo" "_be")
 (setq DM (getvar "DYNMODE"))
 ; save layer and color here (omitted)
 ; set layer and color you want here (omitted)

 (initget 1)(setq p1 (getpoint "\nSpecify start point of text: "))
 (setq rot (getangle p1 "\nSpecify rotation angle <0>: "))
 (if (null rot) (setq rot 0.0) (setq rot (* 180.0 (/ rot pi))))

 (setvar "DYNMODE" (- 0 (abs DM))) ; Avoid problems with some graphics cards

 (setvar "MTJIGSTRING" "Example")
 (initdia) ; Dialog/ContextualTab !
 (command "._mtext" p1 "j" "TL" "r" rot "h" th "L" "E" (strcat (rtos (getvar "TSPACEFAC")) "x") pause)

 ; restore saved layer and color here (omitted)
 (setvar "DYNMODE" DM)
 (command "._undo" "_end")
 (princ)
)
Vault Professional 2023     +     AEC Collection

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: How to display context ribbon
« Reply #6 on: June 16, 2010, 03:46:08 PM »
Contextual ribbons are controlled by the CUI. See the CUI editor, section Ribbon, then Contextual Tab States. There are a lot of actions below it, like "arc selected" but also "Text editor in progress". You can drag and drop a tab (existing or newly created) to this and from that point the contextual tab will be shown with that action.

I think it is not possible to show a tab just when a lisp or command is active, but only when you select an object, because that is controlled by the CUI.

The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

kenkrupa

  • Newt
  • Posts: 84
Re: How to display context ribbon
« Reply #7 on: June 16, 2010, 08:47:09 PM »
This is how I would do it:

Nope. With your code that ribbon is not displayed. What ribbon? - see image in previous post.

initcommandversion should only be used if you want to use a special (old) version of a command.

You may be right that it's not needed here. However, it has been found to be needed elsewhere - for mleader in particular - on some systems but not others. This is a confirmed fact, although undocumented. That's what lead me to believe it might be the case here also. But, alas, not so.

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to display context ribbon
« Reply #8 on: June 17, 2010, 02:23:08 AM »
This is how I would do it:

Nope. With your code that ribbon is not displayed.
This is working for the contextual ribbon in Acad2011
Quote
What ribbon? - see image in previous post.
So you're talking about a contextual ribbon, but you want the toolbar? In that case you should set MTEXTTOOLBAR to 1. (see help)
Vault Professional 2023     +     AEC Collection

kenkrupa

  • Newt
  • Posts: 84
Re: How to display context ribbon
« Reply #9 on: June 17, 2010, 11:07:25 AM »
This is working for the contextual ribbon in Acad2011
Yes, I see that the ribbon is displayed with your code, and mine also, in 2011. But not in 2010 - they must have fixed this.

As for the toolbar, it is not necessarily wanted and would probably not be wanted IF the ribbon were displayed. I was not aware of the MTEXTTOOLBAR sysvar, so thank you for that. But it does not help. If I set it to 2 (does not display when the ribbon is on), the toolbar does not display in my routine even though the ribbon is not displayed. Apparently AutoCAD thinks the ribbon is displayed even though it is not. That's why I'm looking for a some code to force that ribbon to display, as a workaround for this release.

Thanks.