How to Remove Visual C++ "Expand Menu" Arrow? - visual-c++

When creating menus with submenus in Visual C++, I find that submenus begin as arrows that I must click to expand to see their contents. Is there a way (programmatically) to have the submenus pop-out already expanded (with no arrow to click)?
Here is an image of what I am talking about, before and after clicking aforementioned arrow:
also here

it seems you are using the MFC Feature Pack.
Go to CMainFrame::OnCreate(), you should be able to find
something like
CMFCToolBar::SetBasicCommands(lstBasicCommands);
somewhere inside it.
lstBasicCommands
is a list that holds all the menu items that are not be hidden initially.
Simple populate it with the items you like.
You may also want to check out the samples code available here:
C:\Program Files\Microsoft Visual Studio 9.0\Samples\1033
In case you do not call SetBasicCommands and do not create the list, the expand button is removed. This releases you from enhancing the list everytime you add a new command.

Related

How to exclude some directories from "Analyze -> Inspect Code" in Android Studio?

One code directory is from a long working library, but the code inspector complains about many issues in it. How do I exclude it from analysis?
I've tried looking at the settings, and also tried right clicking on various things through the analysis.
I'd like the code inspection to work for most of my project, but not from parts of it that work and analysis is unneeded. In this case, it is a complex open source C language library where I do not want to touch the code.
Okay - I feel a bit dumb, but so others don't have to go through this, here are details. Also, it is very easy to screw this up - the Android Studio GUI will let you do stuff that looks good in the dialog, but doesn't work. It took me several tries to find the magic that works.
Here is the procedure:
From the main menu, select "Analyze" then "Inspect Code"
Click the button next to "Custom Scope"
Click the three dots button - to the right on the same line. A new dialog will pop up.
Click the plus ( + ) - upper left, to start a new Custom scope
Give it a name
Select "Local" or "Remote"
In the drop-down of the new dialog, select Project view
Of the four icons, click them until only the one for file display is emphasized
Find the top directory of what you want to analyze, and click "Include"
Find each directory you want to exclude, and click "Exclude" for each
Click OK - the custom scope dialog will close
Click OK - the analysis will run
In the future, that scope is available by name, but remember that it does not honor the implied scope if you right-click a directory in the hierarchy.

Android Studio/Intellij Idea: "Table of Contents" for a class

I have been messing around with Android Studio and so far I like most of what I have seen. One thing that has been annoying me though is this lack of "Table of Contents" for a class. I apologize for not knowing exactly what to call it. But what I am referring to is the dropdown menu in eclipse that lists all the methods, interfaces, classes and so on that are in that class file. This then allows you to jump to that position. This view is when you are in "Package Explorer" and click the arrow to the left of the class. This is one thing that makes me really miss eclipse. I know that you can easily search with Ctrl+F inside a document but I often forget the method names. I tried looking through here but to no avail. Just wondering if anyone knows some way to handle this.
IDEA has a tab called "Structure", which shows all the methods, fields, etc. of the currently-open class.
I've just got a Tip of the Day popup in Android Studio helping with exactly this problem.
You can quickly navigate in the currently edited file with
Ctrl/⌘+F12 (Navigate | File Structure).
It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key. To easily locate an item in the
list, just start typing its name.
Also, as danny117 points out, you can use Alt/⌘+7 to show / hide the same content in a side panel view (shown above in Chris Jester-Young's answer).
View > Tool Windows > Structure
In addition to what Chris Jester-Young said, it's worth pointing out how to see the methods and properties of a class pointed by the cursor.
a) Type Ctrl + H in the class pointed by cursor.
b) In the class name, in the hierarchy window, double-click the class name. The system, upon confirmation, will decompile and open the class code.
c) Alt + 7 (Windows) or Command + 7 (MAC) to display the structure window.
d) One can now visualize properties, methods, derived classes, derived interfaces, and even include inherited items. All related to the class under the caret.
I'm currently using Beta 0.8.9 of the Android Studio and what you need to do is click on the settings icon in the Android Project View. If you select 'Show Members' then the Classes become expandable and you can navigate around the class using the project view.

Visual Studio 2012 changes focus to design pane

when you change documents (ctrl+tab) on WPF (maybe others too) the focus always goes to the design pane.
So imagine - you edit XAML and want to copy an existing element from another existing document.
You are in Doc1 XAML type somethinng next you switch to Doc2 where you have been in XAML pane before.
Now the Designer of Doc2 gets the focus. Since I left the focus in XAML I use shift arrow to select some XAML text - instead the focused control is moved.
The same when you switch back.
VS 2012 simply doesn't remember in which pane (XAML / design) the focus has been.
This is really hard for me since I do this often - and now I have always to grab the mouse and switch back to XAML after changing the current document.
Any idea if this can be change? Or at least if there is a keyboard shortcut to swicht from one XAML to another.
Are you looking for Shift+ESC. This closes the current window that is in focus in Visual Studio Eg. Solution Explorer, Output Window, Immediate window, etc.
Doesn't pressing Shift+F7 help you?
I was getting so frustrated by this but I finally found a work around! If you have a pane collapsed then and only then shift+F7 seems to switch between the panes. The work around drawback is that you only get to view one pane (Designer or XAML) at a time. For some reason Shift+F7 doesn't work when in split view. Small caveat, I am in Visual Studio 2015. I suspect the behavior is the same for 2012. This answer may be more relevant to whomever comes across this knowing that it works for vs2015 though.
Hit Collapse View
Another thing that is important to note is how to ensure one pane is collapsed.
Visual studio seems to remember the last view you had the XAML designer in for that particular XAML file. You can change them per file and visual studio will remember or you can change the default mode a .xaml file will open in by going to (in visual-studio-2015) the tools menu item. Then click options, which opens the options window. Then click XAML Designer, which is the last option in pane on the left of options window. Then change the selected item in the combobox labeled Default Document View from Split View to Source View.
When I first changed the default I didn't think it worked; changing the default will not overwrite the settings saved for the last document view you were in for a particular file. The only way I found to have the default applied was to just wipe out my .suo file for the solution and close visual studio. Deleting the .suo file and closing and re-opening the solution didn't work. I had to delete the file and close visual studio, open visual studio back up, and reload the solution.
The .suo file is hiding in a hidden folder called ".vs" inside the solution folder. I initially just renamed it .suo.bak just in case something happened that I didn't like, but once I reloaded the solution and everything was fine I deleted it.

How to add commands to Visual Studio 2012?

How can I add custom commands to the keyboard dialog (Tools->Options->Keyboard) in order to trigger them by shortcuts? Unfortunately, I could not find any resource on the web.
I crossed this blog post, but it's slightly different, because I'd have to create a menu entry. I only want to show the commands in the keyboard dialog. Just like it worked with macros.
I have not checked VS 2012 in this area, but I think it's the same as for previous version.
All that menu and command stuff is localized in a file called [mypackage].vsct which is the Visual Studio Command Table. The schema is described here: VSCT XML Schema Reference. When you used the wizard it probably created one for you.
As you can see in the schema, a Command is always linked somehow to a Menu (Commands Element), but there are a number of flags you can use to tweak this: Command Flag Element. Depending on what you do, I'd try the CommandWellOnly, DefaultInvisible and DynamicVisibility.
Anyway, if you don't want your menu to appear on the top menu bar, just can also just change the <Parent> element of the root <Menu> element in the vsct file.

Adding an extra column in the sharepoint list preview viewstyle

I am using the Out-Of-The-Box preview viewstyle for displaying a list. My requirement is to display and extra column on the left side of the the view, along with the title column. How can I do this?
Sadly, there is no easy, SUPPORTED way to do this. You would have to modify the preview ViewStyle (as defined in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML\VWSTYLES.XML) to display your column. Now this can certainly be done - display CAML is painful but not impossible, but it would modify the preview viewstyle on your entire sharepoint install. See http://mo.notono.us/search?q=viewstyle for more info
Another way to do this MAY be through javascript (I'd use jQuery), though I am not entirely sure HOW you'd accomplish it. I do know Paul over at EndUserSharePoint.com has done some amazing things with client side script...
You may add the extra column by modifying the default view. To do this, you should see on the right-top corner of the list, a view that is "View all".
- Click on that tag and choose from the drop-down menu "Modify current view".
- You will be taken to a form that allows you to choose which columns you want (or don't want) to be displayed on the "default" view.
- (you have also options to sort, filter, etc... this view attending to your needs).
Also, from the drop-down I mentioned, you can create a "new view" instead of modifying the default one, and then, in the list settings, you are allowed to choose which between all the available views, will be the default one.
Hope this helps...

Resources