03-13-2007 12:00 AM
03-13-2007 12:16 AM
Hello everyone,
This is a tip that I've seen posted on a few forum threads but I wanted to include it here:
Improving the Performance of Table Controls
1. Try to update multiple cells at the same time with SetTableCelRangeVals function. This reduces the overhead of updating cells greatly.
2. If you need to update a single cell at a time (as may be the case if you want to update a row with different datatypes, use the SetTableCellAttribute (...,ATTR_CTRL_VAL,...) function instead of the SetTableCellVal function. Note: This will only make a difference if the table is not the active control on the panel. So if it is the active control, programmatically make another control active before updating the table, and then make the table active again. This will update the table without displaying the updates until the next call to ProcessDrawEvents or upon the exiting the current callback. This is ideal when making repeated updates.
Original forum post:
SetTableCellRangeVals using for loading rows: http://forums.ni.com/ni/board/message?board.id=180&message.id=21055
Using SetTableCellVal() in LW/CVI to display about 20000 lines of data. But the speed is very slow,how can I improve it?: http://forums.ni.com/ni/board/message?board.id=180&message.id=6577
Thanks
03-13-2007 12:25 AM - edited 03-13-2007 12:25 AM
Message Edited by Wendy L on 03-13-2007 12:26 AM
03-13-2007 10:07 AM - edited 03-13-2007 10:07 AM
Handling menu items state depending on application state
In several applications it's common to have well-structured menu bars that collect useful functions in the program. Normally, not all menu items can be executed in every program conditions: you may want to avoid taking a copy of test data while a test is still running to prevent the risk of accessing the same data file from two operations; again, you may want to permit starting a test only after an explicit confirmation that testing conditions are safe; even more, you cannot start a test which is already running ( ), and so on.
Individual menu items can be dimmed with SetMenuBarAttribute (, , ATTR_DIMMED, ) when operating conditions change; a disadvantage in doing this is that in every single moment in the program you detect a change in operating conditions you must proceed to dim / undim all menu items interested by this change: this can be long and boring and you may run the risk of forgetting some particular precaution and place the application in an unforeseen (possibly dangerous) state. Moreover, all these operations are performed even if not necessary.
CVI offers an easy and elegant instrument to centralize all menu handling, that additionally adds no unnecessary overhead to the application since it is executed only when the operator fires up the menu bar. This instrument is
InstallMenuDimmerCallback (menuBarHandle, MenuDimmerFunction);
Being called before the menu shows, in MenuDimmerFunction we can individually show or dim individual menu items depending on program working conditions thus being sure that every time the operator is presented with all and only legal items.
Attached sample shows a very simple example of this functionality.
Message Edited by Roberto Bozzolo on 03-13-2007 05:08 PM
03-13-2007 12:21 PM
03-15-2007 11:00 AM
03-16-2007 03:00 PM - edited 03-16-2007 03:00 PM
Message Edited by bilalD on 03-16-2007 04:13 PM
03-17-2007 02:46 AM
Good suggestion, Bilal! I can add that prepending to some letter in Menu item name the usual double underscore ( "__" ) you can set an accelerator key for the option.
...unfortunately Tools menu is already full of items, so only the following letters are available; B D G H J K M N Y W I have added this option to the tools menu, calling it "File bro__wser" to use Alt + T + W as accelerator key
If only adding some shortcuy key was possible....
03-20-2007 03:54 AM
Hello all,
unfortunately, Labwindows has no support for the mouse wheel, which is nowadays commonly used in applications. When using textboxes in the user interface, I think that most users automatically think that the mouse wheel can be used to scroll this textbox up and down (so would I). So I wrote a piece of code that I now include in all my projects to support this request. It's actually quite simple. For each panel that gets loaded, I use the InstallWinMsgCallback function, with the MessageNumber parameter set to WM_MOUSEWHEEL.
Important note: for WM_MOUSWHEEL to be defined, windows.h should be included, and _WIN32_WINNT should be at least defined to 0x0400. To make sure this last definition is made, open the Build Options window (can be found in the Options menu), and enter /D_WIN32_WINNT=0x0400 in the "Compiler Defines" field.
I attached an example program to this message, which shows how to enable textbox scrolling with the mouse wheel in a very simple way. More information on the WM_MOUSEWHEEL message number can be found in the MSDN library:
I hope this post is usefull for at least some of you guys
03-21-2007 04:44 AM
A few accelerators are present in the IDE that can help a lot in developing applications.
Everybody knows that in the UIR editor right-clicking on a control popups a menu by which it's possible to jump directly to control's callback (item "View control callback").
The symmetric action from a source code window is to place the cursor on a control name and press Ctrl-F: you will jump into the UIR editor window with the stated control already selected. This option is equivalent to right-clicking on the control name and select "Find UI object" option).
I recently discovered that this option is present on callback function names too: selecting the function name and pressing Ctrl-F jumps me to the UIR editor window If the function is associated to more controls, a popup window will be shown with the list of controls for we to select the desired control to select.