LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking User Interface from operator input

Is anyone aware of a function, or a short series of functions that can be used to completely block any user input (keyboard or mouse) during portions of an execution. i.e. I am interested in setting and unsetting this condition during runtime. (I am using windows 2000) Thanks
0 Kudos
Message 1 of 6
(3,234 Views)
In message <5065000000080000006CD70000-1079395200000@exchange.ni.com>,
Ryykker writes
>Is anyone aware of a function, or a short series of functions that can
>be used to completely block any user input (keyboard or mouse) during
>portions of an execution. i.e. I am interested in setting and
>unsetting this condition during runtime. (I am using windows 2000)
>Thanks

In the user interface library;
SetPanelAttribute (, ATTR_DIMMED, );
SetCtrlAttribute (, , ATTR_DIMMED, );
SetMenuBarAttribute (, , ATTR_DIMMED, );

In the programmers toolkit;
SetAttributeForCtrls (,ATTR_DIMMED , , 1);

I usually create a function that takes a single integer argument to set
or clear the protection for a number of panels or controls.
E.G.

/* State is zero or one */
void
preventUserAccess(int state)
{
SetPanelAttribute (, ATTR_DIMMED, state);
SetCtrlAttribute (, , ATTR_DIMMED, state);
SetMenuBarAttribute (, , ATTR_DIMMED, state);

// etc.......................
}

--
Regards,

John Cameron.
Type softly, read gently.
0 Kudos
Message 2 of 6
(3,234 Views)
Hi,

Another idea to disable UI operations would be to detach the callback function of the controls and panel. You can use the same setCtrlAttribute with the ATTR_CALLBACK_FUNCTION_POINTER attribute and passing NULL as the function. This will disable any callbacks without changing your UI at all.

Then, of course, you would need to reattach the callbacks to the controls to start to detect events.

Just my 2 cents.

Regards,
Juan Carlos
N.I.
0 Kudos
Message 3 of 6
(3,234 Views)
Juan,
This is an interesting idea, However the title of my request, I think, has misled some of the responses. I am interested in blocking ALL user input, not just to the UI. i.e. all keyboard and mouse events should be blocked until I give control back. Are you aware of a function or technique that will accomplish this?
0 Kudos
Message 4 of 6
(3,234 Views)
If you call the SetInputMode function and pass -1 as the control parameter, it will disable every control in your panel. But the controls will appear grayed out, which I'm not sure is what you want.

If you want your controls to continue looking active but you do not want them to process any events, your best bet is to return 1 from the panel's callback function for any low-level event (mouse click and keypress events).

If you want to go even further and lock out the entire machine, then you can call the DisableTaskSwitching function.

Luis
NI
0 Kudos
Message 5 of 6
(3,234 Views)
Hi everyone!

Just as an extra, here is an example that may help you block the input of the user. It basically shows you how to confine the mouse cursor to your CVI panel and how to disable Alt+Tab task switching.

Together with the ideas posted here, you can block most usder interactions.

I hope this helps.

Juan Carlos
N.I.
0 Kudos
Message 6 of 6
(3,234 Views)