10-11-2005 05:44 PM
10-11-2005 06:21 PM
10-11-2005 06:24 PM
10-11-2005 06:53 PM
10-13-2005 05:58 PM
Thanks for the reply.
The reason I need to have those types of functions is the following. I recevie a message from a softwarte in the following format. "PANEL_CONTROL_NAME:value" I need to set the specified value into the specified name. In order to do that I need to get the handle of that control and panel. So I have the name as a string and I need to get the handles in order to use SetCtrlVal().
We can not use PANEL_CONTROL_NAME as a defined integer as control specifiers in incoming messages because they are not unique. If you have multiple uir files you will have the same integer value for two different controls.
Your recommendations are highly appreciated.
10-14-2005 02:59 AM - edited 10-14-2005 02:59 AM
Message Edited by CVI-User on 10-14-2005 10:02 AM
10-14-2005 03:58 PM
Thanks.
Currently I use constant look up table. But it takes too much time to compare the strings to get a match. (2000 records) I thought LabWindows will provide a function for it.
10-14-2005 04:55 PM - edited 10-14-2005 04:55 PM
If lookup speed is an issue a lookup table is probably still one of the best ways to go. You want to organize the table in a more efficient form for searching. The two structures that come to mind for me are a hash table or a binary tree. This should eliminate search time as an issue.
On a side note, if you wanted to build the lookup table dynamically you could do this by scanning each control of each panel and storing an entry in the table using the control's label value matched to the control id and panel handle. CVI does provide ways to get the number and types of controls on a panel and scan through them. This of course assumes that the label strings of each control match the string name you receive in the “software message”. If they do not, you would need a way to match a controls label to the "software message" to identify which control is the target of which message.
Good Luck!
Message Edited by mvr on 10-14-2005 04:56 PM
10-16-2005 06:25 PM
Hi.
If you don't want to set up a hash table, I suggest you check out the "Lists..." item in the Programmer's Toolbox library. It has built-in functionality for binary searches, so much of the hard work is done for you. You just need to create a comparison function which is used for item insertion and retrieval. I have used this successfully with quite large lists.
Regards,
Colin.
10-20-2005 12:12 PM
Edgar,
Another option that might be easier and faster would be to identify controls by a Panel ID and Control ID pair rather than the control constant name. You are correct that Control IDs are not unique across panels, but the combination of Panel ID and Control ID will uniquely identify a control. You could pass Panel ID and Control ID in your message and the receiving application would convert the Panel ID into a panel handle via a lookup table/list/etc.
-Jeff