LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

preventing the grey square around the active control

I have a panel wit a few indicator controls, and I want the square indicating which control is the active control to disappear. It looks a bit odd around indicators. How can I do this?
 
CVI 6
0 Kudos
Message 1 of 3
(3,492 Views)

Dear Erwin,

if you set a control as indicator in the UIR editor it shouldn't be possible that it is highlighted as other controls with the grey dotted box apart the case that the operator clicks or double-clicks on it: indicators infact are skipped when tabbing through controls with the TAB key and they shouldn't respond to shortcut keys.

To prevent selecting indicators, I use to set a callback for them that swallows (rejects) mouse and keyboard events:

 

/***************************************************************************/
int CVICALLBACK rejectFocus (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event) {
  case EVENT_COMMIT:
  case EVENT_RIGHT_CLICK:
  case EVENT_LEFT_CLICK:
   return 1;
  default:
   break;
 }

 return 0;
}

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,486 Views)
Erwin,

You can swallow all mouse clicks, as Roberto suggests. This will prevent users from ever selecting an indicator control. However, it also means that they will not be able to copy text from the control to paste it elsewhere, for example. This is the reason why we allow mouse clicks on some types of indicator controls, by default.

The gray box that you mentioned is only drawn around the control when the control does not have a label. Otherwise, it is the label that is highlighted instead. I assume, therefore, that your control does not have a label. You can take advantage of this if you want to "hide" the gray box without preventing users from selecting text -- simply give the control a label, but position it somewhere comfortably outside the bounds of the panel ([-20000, -20000] for example).

Luis
NI
0 Kudos
Message 3 of 3
(3,467 Views)