Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiButton not graphically showing focus

So I've got a MFC based dialog box application with a 3D styled button. The problem is that when I'm tabbing through the various controls on the dialog box, I can never tell when the CNiButton has the focus as there is no visual indicator. I found CNiButton::SetShowFocusMode() and tried calling it in my OnInitDialog() handler and passing it CNiButton::ShowFocusMode::ShowFocusControl, but nothing seems to be different. Am I doing something wrong or can a 3D styled button even show focus? Ideally I'd like it to do something similar to a regular windows button when it has focus (Bold the outline/dotted box around the text). Does anybody know anything about this?

 

Thanks! Josh

0 Kudos
Message 1 of 4
(6,284 Views)

So after a little more testing it appears that whether focus is shown or not is dependent on which button style. The 3D on off toggle does not appear to display any sort of focus even when forcing it to via that method I mentioned earlier. Some of the other 3D controls such as the vertical/horizontal toggles will show a white line around them when they have focus. The classic on off toggle button will show it has focus via bolding it's outline, but I'd prefer to use the 3D instead of the classic as it looks better when using colors. The classic has a band of the background color shown around whatever you've chosen for the toggle colors though I suppose I could change the background color in my OnValueChanged() handler to reflect the current state. Also I forgot to mention I'm using VC6, I don't know if this behavior is standard new versions.

0 Kudos
Message 2 of 4
(6,283 Views)

So i tested a little more, and that band of grey that is around what toggle colors I choose apparently can't be altered in the classic style. So that won't work. I've also realized the for some reason, having an NI Control on the page can affect other things that need to show focus as well. For instance, create a new mfc dialog box based project, and then drop a CNiButton (any one style doesn't matter) and a check box to the dialog, then test it and you'll find as you tab through it, the focus on the checkbox is never shown either. It does recieve focus (you can tell cause you can press the spacebar to check or un-check it), but it doesn't display that standard dotted line around the text. Now I'm really confused at to what's going on. Any help would be appreciated!

0 Kudos
Message 3 of 4
(6,280 Views)

Hi,

That little gray band around the button - did you find a way to get rid of it, hide it, or change its color?

0 Kudos
Message 4 of 4
(2,901 Views)