Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2004

Tip: Looking for answers? Try searching our database.

Catching build-in commands events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SM - 10 Dec 2004 11:10 GMT
Hi,

I'm sure this is a very basic thing but I couldn't find any info about
that - figures it's less common to write an add-in than other things :)
What I want to do is to create an add-in using c# which would save the
current state of code pieces collapsing (ie. if a code is hidden or not) in
the project, so it could be restored later when the project is loaded again
(a feature MS left out in all their wisdom).
Unfortunately I'm stuck right at the beginning - I don't know how to hook
the event of calling the "Edit.ToggleOutliningExpansion", so when the user
collapses the code, I could be notified of it and store the action. I'd be
greatful for a simple example of a code with such event handler.

thanks
Carlos J. Quintero [.NET MVP] - 10 Dec 2004 13:21 GMT
The following article of mine incidentally shows how to do that:

BUG: Command events fired only to last addin loaded in Visual Studio .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;555090

Signature

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> Hi,
>
[quoted text clipped - 12 lines]
>
> thanks
SM - 10 Dec 2004 14:49 GMT
> The following article of mine incidentally shows how to do that:

Thanks for your answer, however I haven't managed to make it work. I pasted
the code from your article into a new add-in project substituting the
OnConnection method (or whatever it's name in VB ;) and put the MsgBox in
both OnConnection and BeforeExecute. The add-in is loaded succesfully as the
first box is being shown, but it doesn't show the message when clicking
help/about. Sorry, if it's something trivial, but I haven't used VB earlier
(and I could use it for this single project), so it may be my bad.
Thanks
SM - 10 Dec 2004 18:53 GMT
> Thanks for your answer, however I haven't managed to make it work. I pasted

Well, I'm truly puzzled - after working thru some other examples I finally
stumbled upon this: http://tinyurl.com/6p8qd
It works, but the thing is - I can't find any major difference between it
and your code - well, the CommandEvents is declared as a static public, and
you have it private, but it doesn't matter. The good thing is, that it
finally works :)
The bad - the Edit.ToggleOutliningExpansion command is not invoked when a
user clicks the collapsing button (the little plus or minus sign at the left
site of the code), even though they work the same. I don't know where to
look for the info about the correct command, and the macro recording doesn't
want to save this action (or any other called using the mouse, for that
matter). Any hints?
Thanks
xqsnake - 10 Dec 2004 17:37 GMT
> The following article of mine incidentally shows how to do that:
>
> BUG: Command events fired only to last addin loaded in Visual Studio .NET
> http://support.microsoft.com/default.aspx?scid=kb;en-us;555090

It shows only the bug but doesnt show how to remember COLLAPSED/OUTLINED
methods
I have also searched through the mztools articles and found nothing

But thanks for pointing out the bug anyway;)
Carlos J. Quintero [.NET MVP] - 13 Dec 2004 09:21 GMT
My answer was for this part of the post if you change "Help.About" by
"Edit.ToggleOutliningExpansion":

>I don't know how to hook
> the event of calling the "Edit.ToggleOutliningExpansion", so when the user
> collapses the code, I could be notified of it and store the action. I'd be
> greatful for a simple example of a code with such event handler.

Signature

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> It shows only the bug but doesnt show how to remember COLLAPSED/OUTLINED
> methods
> I have also searched through the mztools articles and found nothing
>
> But thanks for pointing out the bug anyway;)
xqsnake - 10 Dec 2004 17:33 GMT
Hi

> What I want to do is to create an add-in using c# which would save the
> current state of code pieces collapsing (ie. if a code is hidden or not) in
> the project, so it could be restored later when the project is loaded again
> (a feature MS left out in all their wisdom).

my previous post was about this
i want to do the same
but saving collapsed methods (not regions) before solution is closed
(BeforeClosing() event )

do You know how to do it? (how to programatically find and collpse merhods
after loading a solution)
i thought i know how but it seems doesnt work 100% (see "plz HELP" post)

Please help us
SM - 10 Dec 2004 17:54 GMT
> do You know how to do it? (how to programatically find and collpse merhods
> after loading a solution)
> i thought i know how but it seems doesnt work 100% (see "plz HELP" post)

I'm not really sure of what you intend to do. From what you've written in
your previous post, I assume you want to outline all of the project code
files, whether they're open or not. If so, AFAIK you can't do that in such a
way - the visual effect of the text hidden is generated by the environment -
the text files aren't changed in any way. You'd have to do just like in my
case - outline a document every time it's opened. For that you'd need event
handlers to know when to react - and that's what I don't know how to do
(hence my question).
xqsnake - 11 Dec 2004 12:27 GMT
try looking for an interesting You event in EventWatcher.exe in OnConnection
method

http://www.microsoft.com/downloads/details.aspx?FamilyId=EE1C9710-6DF7-4F3F-A5AE
-425A478DDEEB&displaylang=en


hm...
it looks like i dont understand the word outline!
outlined == collapsed?
or != ?

never mind... i want to remeber collapsed methods and classes (not files -
can u collapse file? - strange, collapsing fille = collapse everything in
it?) and after loading a solution collapse programatically all theese
collapsed method before saving solution. As You said MS forgot to do it.
I know how to find all method in all classes
I dont know how to test if its collapsed or not
I'm trying to collapse them but theese docs must be opened and when it
doesnt help when i try to open them
                            Window win = projectitem.Open(Constants.vsViewKindCode);
                            win.Visible = true;

please tell me if u can
thx

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.