LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using GetCtrlMenuAttribute(.....)

Solved!
Go to solution

Hi ,

 

i'm trying to use GetCtrlMenuAttribute , i want to see if a menu item is checked and this is my simple func

 

 

void CVICALLBACK SetLangHeb (int menuBar, int menuItem, void *callbackData,int panel)
{
  int check = -1;
  int status;
  status = GetCtrlMenuAttribute (panel, menuBar, menuItem, ATTR_CHECKED, &check);
  if ( check == 0)
  {
  printf("checked");
  }
}
but it doesn't work..... am i doing something wrong ?

 

 

 

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 5
(3,530 Views)

1) I would assume the opposite behavior:

 

Description:  Specifies whether a menu item has a checkmark.
0 = Does not have check mark
1 = Has check mark

 

2) What do you mean by 'does not work'? You can use the debug mode, set a breakpoint and check the value of a variable, including status.

Wolfgang

0 Kudos
Message 2 of 5
(3,527 Views)

As far as I can see you only need to reverse the logic of your code:

 

  status = GetCtrlMenuAttribute (panel, menuBar, menuItem, ATTR_CHECKED, &check);
  if ( check != 0)  {
         printf("checked");
  }

 

Please remember that this command gets attributes of menus owned by specific controls (e.g. a table): not all controls can own a menu. To retrieve attributes of normal menu on a panel you must use GetMenuBarAttribute.



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?
0 Kudos
Message 3 of 5
(3,526 Views)

Dont mind the

 

 

if ( check != 0)  {
         printf("checked"); 
  }

 

 

my problem is that my function returns -139.....

 

the function fails...it doesn't update my check var.... 

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 4 of 5
(3,522 Views)
Solution
Accepted by Kobi_K

If you use the help available with CVI you can read:

 

-139 UIECtrlDoesNotHaveMenu Controls of the type passed do not have a menu.

 

that's exactly the earlier comment of Roberto...

0 Kudos
Message 5 of 5
(3,519 Views)