03-24-2013 08:06 PM
Is there an attribute for a command button (or other input items, for that matter) that disables further input from that button? I am hoping I won't need to use this, but it might be helpful to prevent a user from overloading the input stream to the program.
Solved! Go to Solution.
03-25-2013 12:37 AM
SetInputMode (panelHandle, PANEL_CONTROLID, 0);
This will disable user input from every UI control (buittons, numerics, strings...) visually dimming it.
SetCtrlAttribute (panelHandle, PANEL_CONTROLID, ATTR_CTRL_MODE, VAL_INDICATOR);
This will prevent user action on the control but it will not dim it.
In my opinion it is better the first solution, since it is evident to the user that the control is not operable.
03-25-2013 01:18 AM
@RobertoBozzolo wrote:
SetCtrlAttribute (panelHandle, PANEL_CONTROLID, ATTR_CTRL_MODE, VAL_INDICATOR);
This will prevent user action on the control but it will not dim it.
In order to dim the control, you can use SetCtrlAttribute ( panelHandle, PANEL_CONTROLID, ATTR_DIMMED, 1 );
To disable one control I thus use both functions: set it to indicator mode and dim it.
03-25-2013 02:42 AM
Just out of curiosity, what's the difference, if any, between SetInputMode and SetCtrlAttribute (indicator + dimmed)?
03-25-2013 03:28 AM
Hi Roberto,
it does make a visual difference in two aspects, see the figure below:
The upper ring control has been made inactive using the two SetCtrlAttribute functions, the lower appearance is due to SetInputMode.
1) Having a control dimmed still shows arrows. Personally I find this counterintuitive
2) The colors are different, too. I don't like it so much having different controls having different levels of grey: If you have an indicator and dim it it looks different than if you have a control dimmed... I think I reported it in this forum before but if I remember correctly it is like this by design...
03-25-2013 04:56 AM
Gosh, I never noticed colour difference! Guess I never tried dimming indicators.
You're right with reference to arrows: SetInputMode leaves them, even if not operable, while setting the control as indicator hides them.
It is to be said though that setting a control to indicator actually moves the control lable to the left a few pixels and this misalignment is very ugly especially if you are lining up several controls and set as indicator only some of them. In this case you need to add at least other two lines to maintain panel aspect:
GetCtrlAttribute (..., ..., ATTR_LABEL_LEFT, &left):
SetCtrlAttribute (..., ..., ATTR_CTRL_MODE, VAL_INDICATOR);
SetCtrlAttribute (..., ..., ATTR_DIMMED, 1);
SetCtrlAttribute (..., ..., ATTR_LABEL_LEFT, left):
For this reason I am not so comfortable with setting controls as indicators, even if I second your opinion on dimmed arrows.
03-25-2013 05:14 AM
Hi Roberto,
I am well aware of the label problem and thus I don't use labels... Instead I use text messages which also has the benefit that the 'label' (i.e. text message) of the control is not dimmed (one still should be able to read the label conveniently even if the control is dimmed)
I am using dimmed indicators if the numbers are not valid, the default value might be misleading. Imagine a numeric result of a computation - while the computation is in progress there is no result...
03-25-2013 09:04 AM
Thank you both for the detailed replies. I'll have to think about which approach I should use.
The discussion reminded me of another question: when in the debugger, I notice that when I change the color or text of a button via SetCtrlAttribute(), the change doesn't take place immediately. It seems to take place when the function exits. (This behavior is occurring within a callback.)
So:
1. is this what happens when running non-debug as well?
2. if so, is there something that can be done to force the update to display sooner? I think refreshing the entire panel would be overkill.
03-25-2013 09:10 AM
Read about 'Processing Events' in the help, in particular the functions ProcessSystemEvents and ProcessDrawEvents
08-04-2015 04:35 AM
i am facing thye same problem although there is alot of very useful discussion about dimming of the induicator but there was no discussion on event process hierarchy my again question will be the same , when i dim or change type of my command button to indicator it seems to take effect on function exit which i dont want , i want to deactivate all command buttons imidiately when i press one button and then activate all when command button task complete, is there a way , are there any example or useful matterial for me ,, pleaseeee help