objective c - NSTextView sometimes get grayed out and unable to interact with -


i have nsview inside of "menubar". have button click on , add new nsmenuitem menu. when run code inside custom view in init method view grayed out , i'm unable select it. ideas cause of this. problem seems affect created nsmenuitems after problem occur.

-(id)initwithframe:(nsrect)framerect andtag:(int)tagz{     textfeild = [[nstextview alloc]initwithframe:cgrectmake(19,1 , 110, 18)];     [textfeild setfont:[nsfont fontwithname:@"helvetica" size:15]];     [textfeild setstring:[nsstring stringwithformat:@"notespace %d",tagz]];     [textfeild selectall:self];     [self addsubview:textfeild];  } 

i don't think supposed use [self addsubview:] on menu item. instead, supposed create nsview , place custom view inside it. documentation here: https://developer.apple.com/library/mac/documentation/cocoa/conceptual/menulist/articles/viewsinmenuitems.html

however, according documentation views inside menu item may not receive keyboard events. may work sometimes, since documentation mentions should not place view needs keyboard events inside menu.

what should instead, avoid nsmenu altogether , create nswindow menu appear. can make window look/behave menu.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -