LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I seach a constant name or a label on the control panel?

Solved!
Go to solution

Hi everyone,

 

There are so many controls on the panel, how can I  location one of them through their constant name or label?

 

thank you.

--------------------------------------
on the road to windows
liuerbin@hotmail.com
0 Kudos
Message 1 of 4
(3,553 Views)

To retrieve the constant name assigned to a control in the UIR editor you can use GetCtrlAttribute (..., ..., ATTR_CONSTANT_NAME, ...);

This can be integrated in a loop that iterates on all controls in a panel, this way:

 

    GetPanelAttribute (panelHandle, ATTR_PANEL_FIRST_CTRL, &next);
    while (next) {
        // Your code here

        // ...

 

        // Verify wether there are more controls to scan

        GetCtrlAttribute (panelHandle, next, ATTR_NEXT_CTRL, &next);
    }

 

 

The relevant question, nevertheless, is: are you *sure* you absolutely need to run this way? If you know which control you must locate and operate on, you can save this name in an array and use the array elements instead:

 

// Defining a global array of control IDs

int   ctrl[10];

 

// Saving relevan control IDs

ctrl[0] = PANEL_NUMERIC;

ctrl[1] = PANEL2_NUMERIC;

and so on...

 

// Using saved control IDs

SetCtrlVal (panelHancle, ctrl[0], value);



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(3,548 Views)
Solution
Accepted by topic author Robin Liu

I got.

--------------- 

  • Constant Prefix—Valid for panels and menu bars
  • Constant Name—Valid for controls, menus, and menu items
  • Prefix + Constant Name—Valid for all
  • Callback Function Name—Valid for all, except menu bars
  • Label—Valid for all, except menu bars
  • --------------------------------------
    on the road to windows
    liuerbin@hotmail.com
    0 Kudos
    Message 3 of 4
    (3,546 Views)

    sorry, the question is not described clearly.

     

    Using the Find command to locate an object in user interface resource (.uir

     , I fail to find the object because of misunderstanding the following choice:

    • Constant Prefix—Valid for panels and menu bars
    • Constant Name—Valid for controls, menus, and menu items
    • Prefix + Constant Name—Valid for all
    • Callback Function Name—Valid for all, except menu bars
    • Label—Valid for all, except menu bars.

    now it's ok.

    --------------------------------------
    on the road to windows
    liuerbin@hotmail.com
    0 Kudos
    Message 4 of 4
    (3,542 Views)