03-31-2009 03:07 AM
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.
Solved! Go to Solution.
03-31-2009 03:46 AM
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);
03-31-2009 03:55 AM
I got.
---------------
03-31-2009 04:16 AM
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:
now it's ok.