<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot completely disable a dimmed command button in LabWindows/CVI</title>
    <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414286#M50737</link>
    <description>&lt;P&gt;Whether or not you need to call ProcessSystemEvents to ignore clicks on a button depends on what you are doing at the time and when you will undim the control.&amp;nbsp; The original question came up when the button was being dimmed and undimmed in a callback.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CVI defers processing of events while you are in a callback.&amp;nbsp; If you're not currently in a callback, a click event will be processed when it occurs.&amp;nbsp; If the control is dimmed when that click occurs, (again, outside of a callback), the event will be processed and ignored and you don't need ProcessSystemEvents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if&amp;nbsp;you dim the control from within a callback, then click on the control, then exit the callback without undimming the control, the event will be processed with the control&amp;nbsp;dimmed and will therefore be ignored (without needing ProcessSystemEvents).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the big question is when will you undim the control?&amp;nbsp; If you&amp;nbsp;undim it at the end of a long callback, then you need to call ProcessSystemEvents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if, for example, you open a panel with a control dimmed, and then undim it after some other event, you don't need ProcessSystemEvents to ignore the click.&lt;/P&gt;
&lt;P&gt;Let's say you have a panel with a control for the user to select a filename, and a button to print the selected file.&amp;nbsp; You don't want Print to be active until the file is selected, so it's dimmed initially by default.&amp;nbsp; In a callback for the filename control, after the user selects a file, you can then undim the Print button without needing to call ProcessSystemEvents.&amp;nbsp; Any click on the previously dimmed Print button will have already been ignored.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2011 23:11:10 GMT</pubDate>
    <dc:creator>Al_S</dc:creator>
    <dc:date>2011-01-13T23:11:10Z</dc:date>
    <item>
      <title>Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1412982#M50719</link>
      <description>&lt;P&gt;Hi! Everyone, &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought this topic was solved before, but it comes back to me again.&lt;/P&gt;
&lt;P&gt;Please take a look at the code in the attached project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the call of "Delay(5)" is placed after "ProcessSystemEvents()" call in the A_Callback() function, B-LED always light up no matter what!?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Dimming or making button B invisible doesn't disable the command button at all.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Only when I place the "Delay(5)" call in front of the "ProcessSystemEvents()", the B&amp;nbsp;button will be disabled.&lt;/P&gt;
&lt;P&gt;Just by dimming button B, without "ProcessDrawEvents()" and "ProcessSystemEvents()", won't guarantee the button is disabled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm puzzled.&amp;nbsp; What is the correct way of completely disable a command button?&lt;/P&gt;
&lt;P&gt;Does this&amp;nbsp;problem only happen in CVI 6.0?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 02:45:33 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1412982#M50719</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-13T02:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1413118#M50720</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;did you try&amp;nbsp;DelayWithEventProcessing instead of ProcessSystemEvents and Delay ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings from Bremerhaven&lt;/P&gt;
&lt;P&gt;Norbert&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 07:24:54 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1413118#M50720</guid>
      <dc:creator>ISITEC_RIEPER</dc:creator>
      <dc:date>2011-01-13T07:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414220#M50735</link>
      <description>&lt;P&gt;dcl9000:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;discussion where you got my original example has some discussion on the reason B appears active even when it's dimmed.&amp;nbsp; If the button is undimmed before the event is processed, then CVI will act on the event.&amp;nbsp; The reason for calling ProcessSystemEvents is to process the event while the button is dimmed.&amp;nbsp; Then you won't see the click on B or the light.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the original discussion: &lt;A href="http://forums.ni.com/t5/LabWindows-CVI/Dimmed-buttons-delay-but-do-not-disable-a-button-click/m-p/205111" rel="nofollow" target="_blank"&gt;http://forums.ni.com/t5/LabWindows-CVI/Dimmed-buttons-delay-but-do-not-disable-a-button-click/m-p/205111&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason the position of the Delay is important in your modified example is that if you delay after ProcessSystemEvents, you are clicking after ProcessSystemEvents, so your click wasn't handled by ProcessSystemEvents.&amp;nbsp; You just can't click fast enough to get the click in before events are processed.&amp;nbsp; So, then again, you're back to the click event not being processed until after the control is undimmed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This behavior is not peculiar to CVI 6.0.&amp;nbsp; That's the way CVI processes events.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 22:13:42 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414220#M50735</guid>
      <dc:creator>Al_S</dc:creator>
      <dc:date>2011-01-13T22:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414268#M50736</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------&lt;BR /&gt;Norbert, &lt;BR /&gt;I couldn't find "DelayWithEventProcessing" in CVI 6.0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------&lt;BR /&gt;Al, &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can we conclude that the call to "ProcessSystemEvents()" is always needed before un-dimming a button if one wants to temporarily "completely disable" a button by dimming it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Besides dimming a button, is there other way to temporarily "completely disable" a control (button, switch, ... etc.)?&amp;nbsp; What I mean by "completely disable" is that there is no event generated whatever you do to the "disabled" control item.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 22:51:13 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414268#M50736</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-13T22:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414286#M50737</link>
      <description>&lt;P&gt;Whether or not you need to call ProcessSystemEvents to ignore clicks on a button depends on what you are doing at the time and when you will undim the control.&amp;nbsp; The original question came up when the button was being dimmed and undimmed in a callback.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CVI defers processing of events while you are in a callback.&amp;nbsp; If you're not currently in a callback, a click event will be processed when it occurs.&amp;nbsp; If the control is dimmed when that click occurs, (again, outside of a callback), the event will be processed and ignored and you don't need ProcessSystemEvents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if&amp;nbsp;you dim the control from within a callback, then click on the control, then exit the callback without undimming the control, the event will be processed with the control&amp;nbsp;dimmed and will therefore be ignored (without needing ProcessSystemEvents).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the big question is when will you undim the control?&amp;nbsp; If you&amp;nbsp;undim it at the end of a long callback, then you need to call ProcessSystemEvents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if, for example, you open a panel with a control dimmed, and then undim it after some other event, you don't need ProcessSystemEvents to ignore the click.&lt;/P&gt;
&lt;P&gt;Let's say you have a panel with a control for the user to select a filename, and a button to print the selected file.&amp;nbsp; You don't want Print to be active until the file is selected, so it's dimmed initially by default.&amp;nbsp; In a callback for the filename control, after the user selects a file, you can then undim the Print button without needing to call ProcessSystemEvents.&amp;nbsp; Any click on the previously dimmed Print button will have already been ignored.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 23:11:10 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414286#M50737</guid>
      <dc:creator>Al_S</dc:creator>
      <dc:date>2011-01-13T23:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414302#M50738</link>
      <description>&lt;P&gt;Thanks, Al!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about my second question?&amp;nbsp; Any other way to temporarily "completely disable" a control?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2011 23:27:49 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414302#M50738</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-13T23:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414574#M50741</link>
      <description>&lt;P&gt;Which events are you concerned with? Consider that even decoration 
generate some events (e.g. left and right clic events)! In this respect,
 your request to 'completely disable' a control cannot have a unique solution. Commit events are generated only when the control is in HOT mode, while other events have a wider extension.&lt;/P&gt;
&lt;P&gt;One possible solution is to add some lines at the beginning of control callback and test the control state: if you have used SetInputMode to dim the control you may test ATTR_CTRL_DIMMED attribute; if you have set ATTR_CTRL_MODE to VAL_INDICATOR you may want to test the same attribute. In either case, when dimmed or indicator you may simply exit the function ant that's all.&lt;/P&gt;
&lt;P&gt;This provided you have already implemented Al suggestions on ProcessSystemEvents and so that address a large set of conditions without further coding.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 07:36:06 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1414574#M50741</guid>
      <dc:creator>RobertoBozzolo</dc:creator>
      <dc:date>2011-01-14T07:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1415272#M50745</link>
      <description>&lt;P&gt;Thanks, Roberto!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree.&amp;nbsp; There's no unique solution to "completely disable" a control.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Where to call ProcessSystemEvents() is the key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 18:25:28 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1415272#M50745</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-14T18:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1416876#M50777</link>
      <description>&lt;P&gt;Hello dcl9000,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Al and Roberto have already explained the need for the 
ProcessSystemEvents call while the button is dimmed. I just want to take
 the opportunity to also address the need for the ProcessDrawEvent call 
after you dim the buttons, since you have comments in your code indicating that you weren't expecting to have to call this function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For performance reasons, any attribute that you set in the CVI user 
interface is not reflected in the UI immediately. It will be reflected 
once you exit the callback functions. This allows you to serialize multiple attribute change operations without the UI having to be 
refreshed each time. If you would like any attribute change to 
be reflected immediately, you have to call ProcessDrawEvents (or 
ProcessSystemEvents), explicity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code comments, you mention that the LED will also not light 
up if you don't call ProcessDrawEvents. This, on the other hand, is 
unexpected behavior given that you use SetCtrlVal to light up the LED and not SetCtrlAttribute. 
Unlike attribute changes, value changes are expected to be reflected 
immediately in the UI. However, there was a bug in CVI (see bug 231945 
in the CVI &lt;A href="http://zone.ni.com/devzone/cda/tut/p/id/12156" target="_self" rel="nofollow"&gt;known-issues list&lt;/A&gt;) that caused value changes in an LED control to not draw immediately. Since you're using CVI 6.0, it's therefore not surprising that you're seeing this behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luis&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 17:35:26 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1416876#M50777</guid>
      <dc:creator>LuisG</dc:creator>
      <dc:date>2011-01-17T17:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417082#M50781</link>
      <description>&lt;P&gt;Hi! Luis,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your&amp;nbsp;explanation and time to read my comment in the code.&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;saw this bug&amp;nbsp;had been&amp;nbsp;reported in&amp;nbsp;CVI 6.0 and not resolved until the 2010 version.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Can't believe this LED issue took NI almost 10 years to debug.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 20:02:15 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417082#M50781</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-17T20:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417146#M50783</link>
      <description>&lt;P&gt;A little clarification on that Reported Version field in a Known Issues List...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Reported Version field doesn't specify when we found out about a bug, but who is affected by the bug.&amp;nbsp; In this case, we actually found the bug only a few months ago.&amp;nbsp; A reported version of 6.0 means that all versions of CVI going back to 6.0 would be susceptible to this bug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NickB&lt;/P&gt;
&lt;P&gt;National Instruments&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 20:55:42 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417146#M50783</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-01-17T20:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417322#M50789</link>
      <description>&lt;P&gt;Hi! Nick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this issue is fixed in CVI 2010, does it mean SetCtrlVal()&amp;nbsp;can update the LED instantly enough without using ProcessDrawEvent()?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this case: &lt;A rel="nofollow" href="http://forums.ni.com/t5/LabWindows-CVI/LED-Indicator/m-p/294514" target="_blank"&gt;http://forums.ni.com/t5/LabWindows-CVI/LED-Indicator/m-p/294514&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;Many of us have known this issue since 2005.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Maybe it wasn't correctly reported as a bug...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 23:18:44 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1417322#M50789</guid>
      <dc:creator>dcl9000</dc:creator>
      <dc:date>2011-01-17T23:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot completely disable a dimmed command button</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1418124#M50800</link>
      <description>&lt;P&gt;Yes, in CVI 2010 and later, SetCtrlVal will update the status of the LED immediately, as it should have all along.&amp;nbsp; It does look like the forum you mentioned never resulted in an actual bug report, which would explain why we were unaware of the issue until recently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NickB&lt;/P&gt;
&lt;P&gt;National Instruments&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2011 14:30:35 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/Cannot-completely-disable-a-dimmed-command-button/m-p/1418124#M50800</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-01-18T14:30:35Z</dc:date>
    </item>
  </channel>
</rss>

