What to do when TreeViews or ListViews don’t show selection or inactive selection

While working on a community app project (you’ll hear more on this later), I needed help setting the selection (and inactive selection) on a tree view. 

Just a refresher from my first ever blog post,

Explanation of Focus and Selection

Focus: Only one control or UI Element can take focus at a time. If I were to press a key on the keyboard, the keystroke can only be sent to that control with focus.

Selection: Multiple controls can have multiple items selected. List boxes can have as many or as few items selected.

Inactive Selection: When focus moves away from the list box (with selected items) to another control, those list box items are said to have inactive selection:

Active Selection: The selected list box item with focus. Hence, only one item can have Active Selection.

Suppose you have a form that consists of a button and tree view or list view with several nodes. Start with selecting one of the nodes either by clicking to tabbing/arrowing to it. When you tab away, the selection will disappear. The same will happen via code if you try to select a node. The node is actually selected, but there’s no visible indication.

To fix this, there’s a property called HideSelection.  After you drop your list view or tree view onto the form, set HideSelection = False. Now, you’ll see the selection or inactive selection whether you’re selecting via code or tabbing away from the control.

Same goes for Standard Win32 Controls. For example, on a standard Win32 tree view control, you’ll need to set the TVS_SHOWSELALWAYS style bit.

And I thought I had retired this category feed. Old habits die hard. <grins>

Disabling the IDE Navigator (Ctrl-Tab Dialog)

I’ve had a few questions come back to me about disabling the IDE Navigator, aka the Ctrl-Tab Dialog. Here’s how to do it:

  1. Open Tools – Options – Keyboard
  2. Under “Show commands containing:”, type in “Window.NextDocumentWindowNav”
  3. Press the Remove button to remove the “Ctrl+Tab” keyboard shortcut binding

If you want the Visual Studio .NET 2003 Ctrl-Tab behavior, continue with these steps:

  1. Under “Show commands containing”, type in “Window.NextDocumentWindow”
  2. Under Press shortcut keys, press Ctrl+Tab.
  3. Press Assign to bind the keyboard shortcut
  4. Press OK to accept changes and dismiss the tools options dialog

And ctrl-tab will cycle through all open documents without the IDE Navigator popping up.

View original comments

Guidelines–a hidden feature for Visual Studio Editor

Update 12/2/2004:  Uploaded an image from Visual Studio 2005 Beta.  Note the image below shows guidelines at column numbers 5 and 30, but the regkey value is RBG(255,0,0), 4, 29.  The Guideline column numbers are 0-based in the registry.

Update 11/29/2004: I’ve corrected the two (embarrassing) typos below.  I must have had thanksgiving dinner on the brain at the time.  1.  The reg key is [HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\8.0\Text Editor (note the space between Text and Editor).  2. It’s RGB, not RBG.  The example had a typo, but it is now corrected.

Guidelines at columns 5 and 30

Guidelines are visible column indicators for the VS Editor. During the last test pass, I came across a test case named “Guidelines” which got my immediate attention. I never heard of this before, so I made sure to spend extra time testing this cool, but hidden little feature during the Beta test pass. I didn’t find any issues with it, so I feel it is safe to share. Let me know if you run into any issues with it.

Warning! To enable guidelines, you’ll need to modify your registry settings. Follow the instructions below at your own risk.

Enabling Guidelines

First, shut down Visual Studio 2005 if already started.

Under

[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\8.0\Text Editor

Create a string value called “Guides”

Set Guides to the following

RGB(x,y,z) n1,…,n13

Where x,y,z are the RGB values and n is the column number. You can have at most 13 guidelines.

For example,

Guides = RGB(128,0,0) 5, 80

will place a Red guideline at column numbers 5 and 80.

And now launch VS and open a text file.

Disabling Guidelines

An obvious no-brainer, just delete the Guides keys you created above. Restart VS, and no more guidelines.

View original comments

Heading back home to N’awlins

Technically, I’m from the Mississippi Gulf Coast, but I tell people I’m from New Orleans. The Mississippi Gulf Coast is radically different than the rest of Mississippi. It’s the New Orleans spillover and arguably the retirement community for the city. It is just easier for me to say I’m from New Orleans, rather than having to explain where my accent comes from.

This will be the first time I’ve been home since I joined Microsoft. We’re having a family reunion in the French Quarter at Tujagues (pronounced “to-jacks”). My grandmother on my mom’s side had 12 kids, and the youngest is turning 50 this year. I have 55 first-cousins, so our family get-togethers are never small.

I’m going to spend a week down there in New Orleans and in Bay St. Louis and spend TurkeyDay with my family. I’m really looking forward to some vacation time in the warm sunlight (unlike the current Seattle weather right now).

Here is a list of foods I can’t wait to eat again:

  • Red Beans and Rice
  • Beignets and real coffee at Café Du Monde
  • Crawfish Etoufee
  • Peel the tail and suck the head on some crawfish – if any are still around
  • Eating boiled crabs the way they were meant to be eaten
  • Oyster po-boys – I’ve already broken 3 fillings from biting down on pearls
  • Shrimp po-boys
  • Any homemade cooking offered to me
  • Sweet Tea!

I plan to do a lot of running along the beach and going back to my hometown’s gym to burn off some of these calories. <grins>

And yet another post about Halo 2… but at least this time it comes from a girl ::shrugs::

Halo 2 kicks butt.

Yep, I was one of those waiting in line an hour before the company store opened to ensure I would be playing Halo 2 when I got home from work.  Alas, I was only able to play an hour last night. ::sobs::

Things I like about Halo 2 in comparison to Halo:

  1. Dual weapons
  2. New and improved Marines
  3. Turbo on the ghost
  4. The Battle Rifle
  5. Beating someone out of their warhog or ghost
  6. Closed-captioning

I haven’t had a chance to play yet on Xbox live, because I haven’t setup my subscription (never really wanted one until now). I’ll get it setup this weekend and post my gamertag somewhere around here.

All i know is that I got some serious Halo 2 playing to do this weekend.

What is a Nighlty Test Case?

Why is a nightly called a nightly?

A nightly is a test case that must be run every time there is a new build. Since a new build is published every night, these tests are run nightly, hence the name. Other teams call these tests Acceptance or Self-Host, but the concept remains the same.

What should a nightly cover?

A good nightly test case verifies the following:

  1. Is the feature usable?
  2. Can the user perform basic end-to-end scenarios?
  3. Most importantly, if a certain feature/scenario is broken, does the dev need to drop everything and immediately fix the issue?

Think of nightlies as regression tests. The nightlies cover the most important scenarios, so if the test case fails, a regression has occurred that the dev must investigate immediately. (If you’re wondering why don’t devs just run tests before checking in, they do – which is a topic for a later time. Or if you’re wondering why don’t devs just have the testers test the build before checking in, we do – called buddy tests – which is a topic for a later time.)

Consider creating a new text file. Putting the above into practice, a create text file nightly may verify the following:

  1. Is a Text File template available on the New File Dialog? Is the Text File created upon ok’ing the New File Dialog with the text file selected?
  2. Can the user insert text into the Text File?
  3. Can the user perform basic editing scenarios, like cut, copy, paste, and selection?
  4. Can the user save the Text File? Does the File – Save As dialog appear upon save?
  5. Does the text file appear dirty upon editing it?
  6. Can the user close the file?
  7. Does the file appear in the Most Recently Used list?

Why doesn’t a nightly cover more?

One might think, “that isn’t very much testing for a text file,” but consider how many different languages we support, how many different OS we support, the different SKUs, and the Express Skus. After a while, the testing matrix really starts to get big, especially given that we’re not only running these tests with every new build, but we’re also analyzing the results for each new build. And, there are more than 5 builds a week, believe me, when you add in all the different flavors of runs I’ve mentioned above.

To reiterate, the point of a nightly is to ensure that the feature is “testable”, also called “Self-Test”, and to find any regressions. If nightlies are passing at 100%, the feature is said to be “Self-Host” or testable for other scenarios. Once QA signs off on a feature / build, the feature / build is said to be shippable. Once nightlies are finished running, we are able to say, “This build or feature is Self-Host."  If the build fails (obviously implying no features are testable), the build is considered Self-Toast, a term used by the build lab, which is a great play-on-words.

Real-World Examples

Want some real world examples of nightlies doing their thing? Well, I’ve been tasked with coming up with a way to share my team’s nightlies to the community for review and feedback. So, I’m going to start with posting a couple of my own nightlies for you to critique pretty soon. Say tuned.

Update:  11/5/2004

Looks like I had a typo above in the Self-Host and Self-Test terms.  I’ve corrected it above, but just to be clear:

  • Self-Test means feature is testable – devs have run their set of initial tests, so we know that the feature is testable by our nightlies

  • Self-Host means our nightlies are passing – the feature is ready for more in-depth testing

  • Sign-off means QA acknowledges that the feature can be shipped.

A look into our wonderful world of testing

ScottGu, the ASP.NET Product Unit Manager, has put together quite a detailed overview of the ASP.NET testing team’s world, which maps closely to my team’s world.

http://weblogs.asp.net/scottgu/archive/2004/10/28/249458.aspx

Check out the Maddog screen shots…

Picture 3 shows what we think of as a “test case”. If someone says, “hey, point me to your test case that covers scenarios x, y, z”, you would give them the test case number that is shown in the upper right hand-corner.

Something else to note about Picture 3 is the hierarchy to the left. Test cases are listed under “Areas”, as indicated by the folders. If you check out Designing a Test Specification, you’ll get a better idea of how test cases are related to test areas. (and vice versa if you’ve read that post, but haven’t seen this picture yet).

Picture 5, Picture 6, and Picture 7 are what we think of as the test case run, or just “Run.” As feature owners, we’re mostly interested in the Results tab, that is, finding out whether the test case passed or failed, and if it failed, marking why it failed