How to determin wich control has focus

I'm using arrow keys to drive an external device. I catch the main vi key events and act on it. On this vi is also a textinput. When I navigate true is input with arrow keys the main vi events are also fired. That of course should not happen. Is there a way to distinguis between such events. Thus between a vi's main keyboard events and keyboard events in a control on this vi. I thought of finding out wich control has focus.?

Sometimes when you dialog controls, the last "OK" button added to the front panel has the focus turned on by default. You can right click on the control and select "Customize >> Key Navigation" and select "None" in the list.
It seems you have a different problem and are using event structure. Nomally we use the "Value Change" as event condition. Is it possible that you may choose a different condition, such as "Key Down, Key up, etc"?
-Joe

Similar Messages

  • How to determine which application has focus in Windows

    Hello all-
    I'm trying to work around the "Labview freezes when there is large data on the clipboard known issue" (http://forums.ni.com/t5/LabVIEW/Labview-freeze-when-accessing-a-custom-menu-with-data-on-the/m-p/200...) and one thought is to try to determine if Labview has focus, and if it does then clear the clipboard.  If Labview doesn't have focus, then let the user use the clipboard.  This would be a good work-around because it would let the users paste screen shots and such into notes files and wouldn't risk a nasty clipboard/ menu/ freeze-crash.
    My initial search for determining windows application focus, came up empty though.  This old thread (from 2005) pretty much covers it:
    http://forums.ni.com/t5/LabVIEW/Is-there-a-simple-way-to-programatically-tell-which-VI-window/m-p/20...
    The "Is Frontmost' property does not do it.  I need to determine if Labview has focus, as opposed to Windows, notepad, firefox, etc.  I also reviewed the commad prompt commands and didn't find anything immediately helpful there either.
    Any ideas?
    Thanks,
    Casey
    Solved!
    Go to Solution.

    Christian-
    That's perfect!  By using GetForegroundWindow, GetWindowTextA and GetWindowFileNameA in user32.dll I can detect which window has focus.  If Labview has focus then I programatically clear the clipboard so the user can still use it when not clicking on Labview windowns, but also we do not risk a freeze and crash because of the clipboard/ freeze bug.
    I briefly thought about using the .NET versions of these functions, but because that would have forced an upgrade to at least .NET framework 3.0 for all of my user computers, I decided on the unmanaged user32.dll.
    Thanks for the suggestion.  I think I'm pretty close to a work around here that should last me until they fix the clipboard/ freeze bug.
    Thanks,
    Casey

  • JSF: How to determine which element has the focus?

    Hi all,
    I have a JSP with some input fields and a text area. When I press "ENTER" the data I have entered should be saved. That works fine (I use JavaScript to catch the keyPressed-event). But when I want to insert a new line in the text area, I press ENTER too and this invokes the javascript function. So it�s not possible to insert a new line in the text area. And I don`t want to save the data when I�m just inserting a new line.
    is it possible to determine which element has the focus at the moment of pressing ENTER? if it`s the text area then I won�t save the data and inserting a new line is possible? Or how to say: "Insert an new line if the user presses SHIFT+ENTER" or something like that?
    I�m using JSC for my application and this is my JS-function:
    function checkIt(evt)      
    var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
         if (charCode == 13)
              document.getElementById('form1:bt_Save').click();
              return false;
              return true;
    I�m looking for something like that:
    if(charCode == 13) {
    if(document.getElementById('form1:textArea').hasFocus())
    doNothing...
    else {
    document.getElementById('form1:bt_Save').click();
         return false;
    thanks for any help

    Hi,
    I searched through many forums (js of course too) but
    I couldn�t find a solution. Everybody knows how to
    set the focus but not how to get it. We often use
    JSF/JSP with javascript and maybe somebody here has
    another approach to this problem (how to solve it
    using jsf itself or anything else)?Take easy. I just suggested to search in a JavaScript forum , in your question you didn't mentioned this. Good luck man.
    Cya.

  • How to determine which user has an Access 2013 databse open

    How can I tell which user / PC has opened a Backend Access database?

    If the file is stored on a server and you have access to it, you could check in Computer Management, then go into System Tools, Shared Folders, Open Files, and you should find the file listed there along with which user has it open currently.

  • First boot of local zone - how to determine when sysidtool has finished

    Hello,
    we use a /etc/sysidcfg in order to do the solaris base configuration automatically. After the first boot of a local zone I recognized that some tools are started by solaris (sysidtool, etc.) which apply the settings mentioned in /etc/sysconfig.
    Since we want to script some post-install set-ups I need to know, when the first boot including all "first-boot-scripts" has completely finished. Is it possible to query this information, maybe by calliing a special tool or by looking up some string within an logfile?
    I would be grateful for any hints,
    Thomas

    I haven't checked, but I assume they have normal dependencies in the SMF tree so that other services don't start until they complete.
    I would probably look at the milestone/multi-user-server service and see if it's online yet. If it is, they're probably done.
    Darren

  • How to determine if printer has A4 size paper

    Is there any way to determine whether the default printer is configured for A4 or NA_Letter size paper?

    Have you tried a ruler??

  • How to determine which drive has the most recent backup?

    I have a few drives that contain backups of files. What would be the easiest way to figure out which of the drives has the most recent backup? When I sort by date, the folder shows one date, though the files inside show a different date? Is there a way to quickly check the drives to find which is the most recent?
    Thanks.

    the folder modification date isn't reliable, as is only tells of changed in the folder, but not in subfolders. there is no efficient way. I however highly suggest Time capsule, it is WAY easier and you can ask it not to sync the System data and/or applications, so it would prevent this hassle.
    You could try this: go to the first drive, type different letters, like a for instance, and see which file is the most recent document/folder.
    do the same thing on the other drives and compare.

  • How to determine if mbp has key logger or spyware

    Strange logs and possible spyware. Brand new mbp, migrated from older mbp and now wondering if i should wipe it clean and start over. Not sure what all migrated over to my new mbp.
    Most of my google questions took me to Linc Davis discussions.
    I am new to this help site and appreciate the expert advise.
    Thank you for helping!  Please let me know what logs you need to assess the situation.

    Just retrieve it like any other attribute !!!!String returnedAtts[]={"sn","givenName","distinguishedName","msDS-UserPasswordExpired"};
    searchCtls.setReturningAttributes(returnedAtts);
    Attributes attrs = sr.getAttributes();
    if (attrs != null) {
    try {
    System.out.println("Password Expired: " + attrs.get("msDS-UserPasswordExpired").get());
    .....A constructed attribute simply means that it's value is automagically constucted by the domain controller when it is explicitly requested. It is not an attribute where the value is stored in the directory.
    No need to refresh caches etc.
    The reference to refreshing the cache for .NET (and in particular ADSI) is that ADSI automagically constructs a cache for all of the persisted attributes of an object.

  • How to determine wich button is clicked?

    ... and so on. If you have the time the whole thing is
    downloadable
    here.. Greetings
    from Sweden. Here's some of the code...

    that is very easy to do that.
    First u assign a separate variable for each button (or) keep
    an array where its length is total no of buttons instead of
    variables.Store 0 as values for all buttons.
    When one button is clicked make the index for that button to
    1 and if another button is clicked make the index for that button
    to 1 and remaining values to 0.
    So,write a function to check the values in array and if 1 is
    there change the color of that button to grey and other buttons to
    black.
    Try this and tell me whether it works or not.

  • How to determine if 2851 has PWR-2851-51-AC-IP

    We have always ordered our 2851 with PWR-2851-51-AC-IP in case we go POE with internal switches. What show command can I use to see if the routers have these power supplies ?

    There is probably a better way but here is one:
    sh environment
    Main Power Supply is AC with -48V
    -48V supply status: OK
    -48V relay status: ISOLATED
    Fan 1 OK
    Fan 2 OK
    Fan 3 OK
    System Temperature: 28 Celsius (normal)
    Environmental information last updated 00:00:25 ago
    with out a AC-IP power supply:
    sh environment
    Main Power Supply is AC
    Fan 1 OK
    Fan 2 OK
    Fan 3 OK
    System Temperature: 28 Celsius (normal)
    Environmental information last updated 00:00:23 ago

  • How to determine which Windows application has focus

    I'm new to JAVA and new to programming. I hope someone will help me out. I'm trying to write a simple JLink program (JLink is a JAVA API for Pro|Engineer, a CAD design program). In part of this program I need to determine if Pro|E has focus. Is there some way to use JAVA to determine which actively running Windows application has focus?
    I basically want my program to pause when focus changes to another program. For example: While Pro|E is active and has focus the program runs, when I select an Excel window, or Outlook, or Notepad or any other window my program will pause until focus is returned. I just need to determine which window within Windows has focus.
    I hope I have explained this properly. I searched the internet for an answer but found nothing. I did come across some references to JNI, but I'm not sure what that is or how to use it.
    Thank you!

    I just need to determine which window within Windows has focus.No, you don't. All you need to determine is whether your application has the focus. If it doesn't, then some other application does, but it's really irrelevant which one does. All that's relevant is that your application doesn't have the focus and hence it should pause.

  • How to change the background of the StackPanel control when any child element has focus?

    Hello folks!
    I need to change the background of the StackPanel control when any element within the StackPanel has focus. I am executing the code snippet below. The code works fine with elements within the Grid control named "main". It doesn't work when I focus
    an element within the Grid control named "header".
    <StackPanel x:Name="techReportStackPanel" Width="250" Background="{Binding ColorBrush}" >
    <StackPanel.Style>
    <Style TargetType="{x:Type StackPanel}">
    <Style.Triggers>
    <DataTrigger Binding="{Binding ElementName=techReportStackPanel, Path=IsKeyboardFocusWithin}" Value="True">
    <Setter Property="Background" Value="Gray" />
    <Setter Property="Opacity" Value=".5" />
    </DataTrigger>
    </Style.Triggers>
    </Style>
    </StackPanel.Style>
    <Grid x:Name="header">
    <TextBlock x:Name="headerColumn" Text="{Binding Name}" Style="{StaticResource ColumHeader}"/>
    <Button Visibility="{Binding ElementName=headerColumn, Path=Text, Converter={StaticResource delButtonVisibilityConverter}}" Command="{Binding DelCommand}" Content="x" ToolTip="{l:Translate TechReportDeleteToolTip}"/>
    </Grid>
    <Grid x:Name="main">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <wpftoolkit:WatermarkTextBox Grid.Column="0" Style="{StaticResource OrdinaryTextbox}" Watermark="{l:Translate LengthLabel}" ToolTip="{l:Translate BoreholeSpacingInRow}" Text="{Binding BoreholeSpacingInRow, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat=F2, Converter={StaticResource zeroToEmptyDoubleConverter}}" />
    <wpftoolkit:WatermarkTextBox Grid.Column="1" Style="{StaticResource OrdinaryTextbox}" Watermark="{l:Translate WidthLabel}" ToolTip="{l:Translate BoreholeSpacingBetweenRow}" Text="{Binding BoreholeSpacingBetweenRow, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat=F2, Converter={StaticResource zeroToEmptyDoubleConverter}}" />
    </Grid>
    </StackPanel>
    Any advice and suggestions will be greatly appreciated!

    >>It doesn't work when I focus an element within the Grid control named "header".
    You mean when the Button in the "header" Grid is focused? A TextBlock is not focusable so when the Button is not visible no element in the "header" Grid will be focused since you only have two elements in the "header" Grid.
    But when the Button is visible it should work. Please refer to the following code:
    <StackPanel x:Name="techReportStackPanel" Width="250" Background="{Binding ColorBrush}" >
    <StackPanel.Style>
    <Style TargetType="{x:Type StackPanel}">
    <Style.Triggers>
    <DataTrigger Binding="{Binding ElementName=techReportStackPanel, Path=IsKeyboardFocusWithin}" Value="True">
    <Setter Property="Background" Value="Gray" />
    <Setter Property="Opacity" Value=".5" />
    </DataTrigger>
    </Style.Triggers>
    </Style>
    </StackPanel.Style>
    <Grid x:Name="header">
    <TextBlock Text="text..."/>
    <Button Visibility="Visible" Content="Button" />
    </Grid>
    <Grid x:Name="main">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBox Grid.Column="0">main grid...</TextBox>
    <TextBox Grid.Column="1">main grid...</TextBox>
    </Grid>
    </StackPanel>
    When the Button is focused the Background colour of the StackPanel is set to Gray as expected.
    If you want to be able to focus the TextBlock you should set its Focusable property to true:
    <Grid x:Name="header">
    <TextBlock Focusable="True" x:Name="headerColumn" Text="{Binding Name}" Style="{StaticResource ColumHeader}"/>
    <Button Visibility="{Binding ElementName=headerColumn, Path=Text, Converter={StaticResource delButtonVisibilityConverter}}" Command="{Binding DelCommand}" Content="x" ToolTip="{l:Translate TechReportDeleteToolTip}"/>
    </Grid>
    Hpoe that helps.
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • How does DIADEM import TDMS files? How gets every channel his number and groupindex? How can I determine which channel has which groupindex and number?

    I store different channels in a TDMS file.
    I like to have a time channel at the first position with group index 1 and number 1.
    When I read the TDMS file with DIADEM the time channel (Float64) is on a differernt position, and the channels are not sorted alphabetically.
    Here are my questions:
    How does DIADEM import TDMS files?
    How gets every channel his number and groupindex?
    How can I determine which channel has which groupindex and number?
    Best regards
    Joerg

    Hi Jörg,
    i suppose that you´re programme whose create the *.tdms file is writing on false position. Try to create datas with timechannel on first indes in diadem, then save it and then open it again. you see that all is correct. So please tell me what programm in what version do you use and please attache it here.
    Did you use the library for creating *.tdms files like in the link ?
    http://zone.ni.com/devzone/cda/tut/p/id/6471
    Here you find the gtdms_8.x.zip - when you extract it and opened the *.llb you find vi´s for all functions e.g. writing 2d array of strings to *.tdms file
    when you open the subvi´s then you see how created and writing datas/structure to *.tdms files. Because *.tdms is binary you can´t see structure with open it in editor.
    When you don´t have Labview you can use the 30 days test of current version 8.5 under following link
    german version download link
    https://lumen.ni.com/nicif/d/lveval/content.xhtml
    english version download link
    https://lumen.ni.com/nicif/us/lveval/content.xhtml
    Hope it helps
    Best Regards

  • HT4059 Being new to iBook publishing I need to know if stats are available to determine how many times my iBook has been downloaded. Can anyone help please? Mr Ignorant

    Being new to iBook publishing I need to know if stats are available to determine how many times my iBook has been downloaded. Can anyone help please? I need to persuade someone that this really is worthwhile. Mr Ignorant.

    The only people who can possibly assist you with this is Apple Customer Relations, call your local Apple contact number and ask for Customer Relations then explain your situation clearly and politely (be firm but don't rant).
    You might want to investiage what the local laws are regarding defective goods and 'fit for use' definitions on warranties etc. Consumer Protection can be a useful tool to use or bargain with if needed ...

  • How to determine cursorline in table control

    Hi,
    Every time an entry is inserted in the table control i need to put the cursorline in the next line.
    It is ok while you are using the initial lines of the table control but when you use the scroll it is gone.
    The complet scenario is:
    - my table control is created with 5 lines.
    - Every time the user inserts a line, a new line is created (so you will have always 5 lines behind to complete)
    - when the 5th line is inserted, if you want to fill the 6tn you have to use the scroll
    - In this moment is when i dont know how to determine the cursorline. It will be different depending how much de the scroll is moved. Maybe the correct cursorline is 5, or 3 or 2... Do you know how i can determine it? Is it possible?
    Maybe the way would be to move the table control (scroll) one position and always cursorline would be 5, but i dont know if it possible neither.
    Thank you,
    Manel

    Sorry misunderstood the question.
    You will have to use the variable topline from the tablecontrol.
    Edited by: Pedro Guarita on Feb 10, 2010 5:25 PM

Maybe you are looking for