Tab control event Keypress

Hello,
I'm using a Tab control and can't find out how to handle the following situation.
We know that when operating a Tab control we can jump from Tab to Tab by pressing <Ctrl-Tab>.
When at the last Tab I would like to jump to another conbtrol and not again to the first Tab.
Unfortunately in this situation <Ctrl-Tab> doesn't generate an EVENT_KEYPRESS.
Is there a way to handle this situation?
Solved!
Go to Solution.

I don't understand why you cannot get the keypress event: I have tried to modify TabExample example installing a callback on the tab control and properly get the keypress event on Ctrl+Tab. Here the code for the tab control callback function:
int CVICALLBACK TabCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
int nextCtrl, lastTab, pageIdx, virtualKey, modifierKey;
if (event == EVENT_KEYPRESS) {
GetActiveTabPage (panel, control, &pageIdx);
GetNumTabPages (panel, control, &lastTab);
lastTab--; // Zero-based index
virtualKey = eventData1 & VAL_VKEY_MASK;
modifierKey = eventData1 & VAL_MODIFIER_KEY_MASK;
// Properly handle Ctrl+Tab
if (modifierKey == VAL_MENUKEY_MODIFIER && virtualKey == VAL_TAB_VKEY && pageIdx == lastTab) {
GetCtrlAttribute (panel, PANEL_TAB, ATTR_NEXT_CTRL, &nextCtrl);
SetActiveCtrl (panel, nextCtrl);
return 1; // Swallow the keypress event so that active page doesn't change
return 0;
Alternatively, you can handle the situation inside a panel callback:
int CVICALLBACK PanelCallback (int panel, int event, void *callbackData,
int eventData1, int eventData2)
int lastTab, control, pageIdx, virtualKey, modifierKey, nextCtrl;
if (event == EVENT_KEYPRESS) {
if ((control = GetActiveCtrl (panel)) == PANEL_TAB) {
GetActiveTabPage (panel, control, &pageIdx);
GetNumTabPages (panel, control, &lastTab);
// eventData1: a 4-byte integer consisting of 3 fields: 0x00MMVVAA
// MM = the modifier key, VV = the virtual key, AA = the ASCII key
// key masks are defined in userint.h
virtualKey = eventData1 & VAL_VKEY_MASK;
modifierKey = eventData1 & VAL_MODIFIER_KEY_MASK;
// Properly handle Ctrl+Tab
if (modifierKey == VAL_MENUKEY_MODIFIER && virtualKey == VAL_TAB_VKEY && (pageIdx == lastTab - 1)) {
GetCtrlAttribute (panel, PANEL_TAB, ATTR_NEXT_CTRL, &nextCtrl);
SetActiveCtrl (panel, nextCtrl);
return 1;
return 0;
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • Dynamic event registrati​on wont work with Tab control

    In LTR volume 11 No1 we find the "Dynamic Event Handling.vi".
    I had placed the controls on a Tab control and now this example wont work.
    Is there a solution to this problem?
    Scientia est potentia!
    Attachments:
    Dynamic_Event_Registration.vi ‏51 KB
    Dynamic_Event_Registration(controls_on_Tab).vi ‏64 KB

    Yes. The first stage of the code registers mouse down events for all the controls. When you added a tab control that meant that a mouse down event was registered for the tab as well. So now when you click on an object on the tab LabVIEW must decide whether to fire the mouse down on the tab-event, or the mouse down on the object on the tab event...It goes for the first but since there is no description for the tab no dialog will be displayed. If you add a description for the tab you'll see that it fires the event with the tab and you get a dialog with the tab description.
    So - how to fix. Well, it's not that simple, one might think that to exclude the reference to the tab when you register the events would do the trick, but it rather seems that LV will always t
    hink mouse clicks are on the tab and not on the objects on the tab.
    The solution though is to get the references to the objects by reading the controls on page property of the tab control. So instead of reading the controls array from the front panel read the pages references of the tab and then the controls on page array from that and then register mouse down events on that array.
    MTO

  • How to handle events for Tab Control

    Hi,
    I have a Tab control with 4 tabs and I would like when I go to a specific tab all the contents of that tab being updated. Could you please help me with this?
    How should I set the event structure
    Thanks

    Tab Control->Value Change is the event you want.  You can then use a case structure to do whatever you need it to based on the "New Value".
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Events & Tab Control Navigation Buttons

    In the attached example, I use a Tab Control with several pages, some of them being hidden.
    To access them, I use the navigation buttons on the top right corner of the Tab.
    Unfortunately, changing the pages using these navigation buttons does not trigger a "Value Change" event as it does when changing by clicking on the desired page.
    This is visible in the upper control that is updated with the page name when the "Value Change" event is triggered.
    How can I have the TabControl also triggering the "Value Change" event when selecting the pages with the navigation buttons ?
    Attachments:
    TabControl.vi ‏26 KB

    That's a good one, NI should have made the control fire the value change event in that case too. You could make a timeout event and check the value there (and fire an event for it if you wanted) but that's not very elegant. Personally I would go for multiline tabs, it's not often you see a tab with a scrollbar like that so the user's would probably find it more intuitive to have multiline tabs or another level of selection.
    MTO

  • Event Structure: update the structure with a tab control

    Hi!
    I want to be able to update the code contained within an event structure by a tab control value change, in addition to the usual bool controller in the UI. 
    The problem is that the event structure don't seem to run when the bool has a value change for the tab control. I have made a short .vi to demonstrate. A counter is placed in the Event structure so it is possible to see if it is running or not. 
    Any ideas?
    Best regards
    Is my avatar the dog from the fraggle rock?
    Attachments:
    forum_question.vi ‏12 KB

    Here is a version of your code using a Value Signaling property node.
    I "think" it does what you want ...
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    forum_question_mod 2009.vi ‏15 KB

  • How to control the tab control using event structure?

    Hi,
    I am using tab control and event structure in the program.
    When i run the application event is not happening for the active page.
    When user switches from active page to the other page then event is taking place for all pages
    So, how to get the event trigger for the active page when the application is started
    For more clarification i am attaching the code "Test Control Tab using Event Structure.vi"
    Attachments:
    Test Control Tab using Event Structure.vi ‏52 KB

    You have a basic misunderstanding of dataflow. Maybe you should start with some tutorials or study some of the examples that ship with LabVIEW.
    The event structure belongs inside the while loop, and not vice versa. RIght now, the event structure only runs exactly once and never again.
    If the stop is pressed first, the VI will stop. Game over.
    If the tab control is changed (from any state to any other state!), the inner loop will spin forever as fast as the CPU allows, either executing one or the other case. It just reads the tab terminal to decide which case to execute. Changing tab never triggers any events. The VI is trapped inside the event until stop is pressed to stop the VI.
    you were closer to a reasonable program in the other thread:
    http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=287905
    Have you tried execution highlighting? Maybe things would become more clear of you do.
    LabVIEW Champion . Do more with less code and in less time .

  • How to progammati​cally show a specific page of a tab control

    Hei,
    i have a tab control, from which i want to display a specific page if a specific event occured.
    must be simple, but i just cant find the control property for it.
    ... And here's where I keep assorted lengths of wires...

    of course!!
    thanks for showing me the obvious... i have been trying to get to more specific classes...
    thanks a bunch
    ... And here's where I keep assorted lengths of wires...

  • Cursor Legend Tab Control BUG

    Attached is a VI illustrating a bug with the Cursor Legend when graphs are in tab controls. If you enter in a number in the "Cursor X position to move to", then switch pages on the tab control, you'll notice the cursor has moved to the appropriate place, BUT the cursor legend has not changed to reflect that. Once you manually move it, it updates.
    In short, if the cursor position changes programmatically, the cursor legend will update ONLY IF THE XY GRAPH IS VISIBLE, even though the cursor position DOES change.  
    I hope someone from NI will see this post and add it to the bug list (if not already there??). If anyone knows a work around, that would be appreciated also.
    Michael
    Using LV 8.2
    Attachments:
    CursorLegendTabControlBUG.vi ‏27 KB

    Good idea. It doesn't work exactlly, but gave me the idea for how to work around. It appears even if you have a tab value change event doing the same thing the Cursor X Position numeric indicator value change event, the cursor legend X value will not change. You can even try entering the same value in the indicator and pressing return after switching tabs, the cursor legend will not update. It thinks for some reason it is on the correct index. I made a Tab Value change event that first moves the cursor to the next index, then moves the cursor back to the correct index. Ugly but works. Hopefully in the next ver of LV they will have fixed a lot of these cursor bugs; there is definitely some work to be done (i.e. fixing cursor X position for XY graphs, an extremelly annoying bug)
    Michael
    Message Edited by miguelc on 02-23-2007 03:49 PM
    Message Edited by miguelc on 02-23-2007 03:50 PM
    Attachments:
    CursorLegendTabControlBUG_wrkaround.vi ‏34 KB

  • Is there a way to add a LED indicator to the tabs in a tab control

    I have a tab control with multiple rows of tabs. I would like to know if there is a way that I could add round LED indicators to each of the tabs so that I can quickly see the status of each page.  If I only have one row I can just allow for my LEDs to "hover" over the tab, but this does not work if there are multiple rows since the tabs change locations when they are selected.  Does anyone have experience with this?
    Thanks in advance!
    Solved!
    Go to Solution.

    I decided to take some time (probably way too much time!) to try this out and prove it would work.  See the attachment in LV 8.5.1.
    I used arrays and control references to make the code as scalable as possible.  I added several spaces at the end of each label name so that there was some room to place a very small LED.
    The trickiest part (and I would save this until the tabs are named, laid out, and the overall tab control is sized) is to find the best location and screen coordinates for each LED.
    I discovered for best looks, that the LED should jump up and to the left by 2 pixels when its specific tab is selected, just like the label text does.  Otherwise the LED's just jump around on the screen to match whatever row its respective tab is on.
    I have the timeout event randomly turning on and off the LED's, but that would actually be handled by your other code and whatever events determine whether the LED should be on or off.
    Message Edited by Ravens Fan on 09-17-2008 11:59 PM
    Attachments:
    TabLEDexample.vi ‏44 KB

  • Tab Control/Display Data

    Hello All,
    I have an issue with displaying large amounts of data. What my program does is calculate INL/DNL errors on analog to digital converters, when the program runs it generates 3 graphs and a couple of numbers. The idea is to be able to run the program a couple of times and be able to compare data from run to run. My idea was to use the property nodes of a "TAB CONTROL" and create a new tab each run through and store the new graphs and data there. Is this possible? I have not yet figured out how to do so. If anyone has a solution to this or advice on how best arrange such items so they can be easily accessed I'm open for suggestions. Thank you for your time.
    Regards,
    Kenneth Miller

    OK, I spend a few minutes to wire up an example showing my idea above (LabVIEW 7.1). It can be easily adapted for more complex problems such as yours. (E.g. add timestamps, add events for printing, saving, etc. ...)
    I think it is a better solution than layers of tabs. Enjoy!
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ListboxRetrieval.vi ‏78 KB

  • Tab control with 2 pages

    I want to create a Tab control with 2 pages, in each page there are 2 buttons - "OK" and "Cancel".
    If on Page1, "OK" is clicked, Page2 will be disable and greyed, until "Cancel" is clicked. And vice-versa for Page2 buttons.
    How to do this?
    Thanks in advance...
    Solved!
    Go to Solution.

    Hi Splee,
    Please view the attached vi, I believe it's doing what you've asked. You can invoke properties using property node in order to change the value of variables.
    Hi Simply_me check your Vi will it really works. To make this VI in working condition you have to do some more coding in your code.
    Check your page selection technique.
    Hi Splee,
    First you have to find out on which Tab Page user clicking the buttons, the all operations you have to do on other page.
    Once your page is disable you can't access the controls of that page. As Geeta says make a code using event structure with Tab Control property and invoke nodes. 
    You have to do some coding to achieve your requirements.
    Thanks and Regards
    Himanshu Goyal
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!

  • Create a log in tab in tab control and to create one of the tab is disabled and grayed

    Hello there
    Can you helpme to solve my question about log in in tab control? So basically i have two page in a tab control, page 1 contains log in such as username, password and login button and second page is nothing. After the user input the correct username and password into the string form, page 1 will be disabled and grayed and autmoatically will be in page two? I also upload the vi that i created and please correct me if i have something wrong about my vi.
    Please help me with this asap, because i have assignment based on the lab view about client server.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Untitled 112.vi ‏19 KB

    Hi,
    Aaa.. the blue box is an Enumeration Constant. Because I've used something like this you cannot change the name of the Tabs. To fix it:
    Simply replace these two Constants with Numerical Integer Constants 0 - for the first Tab and 1 - for the Second Tab. It took me a while to understand what you wanted to say . This way you can change the name without getting an error.
    I've rewritten the entire VI in order to be clean (I was ashamed of the previous one). You can still use the first one.
    Just an advice: Even if it looks at the beginning more complicated try to use Event Structure all the time when you have buttons. The use of loops with buttons and if structure (like in your vi) creates a lot of problems and it's hard to debug.
    Paul
    Attachments:
    password.vi ‏35 KB

  • Two instances of quirky behavior: array size of empty array and tab control freeze

    LV 7.1
    Array size of empty array. Adding empty arrays to an array of higher dimension produces a fantom array of non-zero size.
    Tab control freeze. An event structure with checked 'lock front panel until the event case completes' option permanently freezes the front panel in certain special circumstances.
    Zador

    tst wrote:
     Tell me if you still think this makes sense.
    Whew, let me look at this tonight after I activate the 4D module in my brain.
    (I think it makes sense, though ) Generally I look at the product of the dimensions array to determine if an array is empty. You can initialize a multidimensional array with some dimensions at zero and it is reproduced nicely in the array size output. Also the "Empty array" tool correctly identifies it as empty, even if some dimensions are nonzero.
    Message Edited by altenbach on 03-15-200612:42 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    init.png ‏3 KB

  • Bug? Tab control breaks graph autoscale (+workarou​nd)

    I had this really annoying problem where two of my graphs did autoscale and the other two didn't... Although all the code and graph properties were exactly the same.
    I finally figured it out...  The graphs are in a tab control. And only the graphs that are on top get autoscaling.  Labview 'forgets' to autoscale the other graphs when you show those other tabs. Even when I use a property node, I can't force the graphs to autoscale, unless they are on the showing tab.
    Feels like a bug to me.... I can understand that graphs aren't updated/autoscaled when they're not shown for performance reasons... but I think the axis should then be updated/autoscaled as soon as the corresponding tab is shown.  And it certainly would be nice if the axis does autoscale when I explicitely ask for it using the property node...
    Now that I understood the problem, I could also make a work-around.   I made a 'value changed' event for the tab control, and put the property node autoscale code in it.  That way, I ask for an autoscale right after showing the new tab page.  (See attached vi for example of the problem and work-around.)
    The workaround works fine... but I think that this should be default built-in behaviour for graphs in tabs that have the autoscale enabled.
    Attachments:
    tabcontrol autoscale.vi ‏32 KB

    Hi Anthony,
    This is a known issue that was partially fixed in LabVIEW 8, which you appear to be using. By partially, I mean that the behavior only persists when you update the value of your graph using a property node (either Value or Value Signaling). If you update the value using a direct wire connection to the graph terminal, or using a local variable, then the problem goes away. I would recommend using either of these methods, because they will fix your issue. Also, in general a direct wire connection or a local variable will greatly improve LabVIEW's efficiency in terms of updating the front panel. The only situation where this fails is if you need to update your graphs from inside a subVI using control references.
    Because that last note is a very real situation, we will notify R&D of this matter so that they can investigate this further. Thanks for bringing this to our attention.
    Jarrod S.
    National Instruments

  • Lock Tabs with Tab Control

    Hi all,
    I am working on a LabVIEW program with a tab control that creates five tabs with questions on each tab page.  I would like to lock the tabs such that the user could not move on to the second tab by clicking on the next tab, but only by clicking on the correct answer to the question displayed on the tab.  If that is not possible, I would like to at least lock the tabs so that the user could only move on to the next tab after a set unit of time, or that they were automatically directed to the next tab after that amount of time.  I'd really appreciate any help that could be offered!
    Thanks!
    Lora

    You could use an Event structure to detect when the user tries to move to a new tab and test for your conditions there.
    Message Edited by jcarmody on 04-17-2009 08:03 PM
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    Example_VI_BD.png ‏5 KB
    Untitled 1.vi ‏12 KB

Maybe you are looking for

  • Need information on Oracle products

    Hi, I am very new to oracle's products, kindly could you guide me with the below information : 1)ORA 10 g app and web server : Is this product a combination of both app and web server? or are there individual products for the same? 2)ORA 10 g databas

  • Process Not Getting EXITED

    BATCH FILE LOCATION : D:\test.bat Ex: test.bat It contains del c:\sample.txt JAVA FILE LOCATION : c:\testunion.java import java.util.*; import java.io.*; public class testunion public static void main(String args[])      try           Runtime objRt =

  • Diffrence between socket connection and URLConnection

    hy friends, though, i know and often work on it but it might be more conceptual for me to know your perception. by the way, what are the main points which diffrentiate the connection between client and server using 1) sokets which in tern using Clien

  • Transport Layers and Target Groups

    Hello, Can one transport layer be assigned to two different target groups?  We have some number range changes that are automatically trying to go to our FIX_QAX target group since it is config, however, the transport cannot be generated because the c

  • IMovie and iMovie HD

    What is the difference between them. I seem to have both on my iBook. They use 50MB and 62 MB of space and if they are the same thing, one of them will have to go. Thanks Frances