开发者

NSButton Inside NSTextField

开发者 https://www.devze.com 2023-02-19 22:55 出处:网络
I\'m trying to create a NSTextField with a button on its right side (similar to a NSSearchView), but I can\'t figure out how to have the NSTextField\'s text scroll without going under the NSButton.

I'm trying to create a NSTextField with a button on its right side (similar to a NSSearchView), but I can't figure out how to have the NSTextField's text scroll without going under the NSButton.

Here is my code thus far:

rightButton = [[NSButton alloc] initWithFrame:rect];
[rightButton setTarget:self];
[[rightButton cell] setHighlightsBy:NSNullCellType];
[rightButt开发者_运维技巧on setImage:[NSImage imageNamed:@"rightButton"]];
[rightButton setAction:@selector(action:)];
[rightButton setBordered:NO];

Any thoughts?

EDIT: Here is a screenshot of the problem.

NSButton Inside NSTextField


I think this is what you're looking for. Basically what you're doing is adjusting the frame to compensate for the button you put inside the field.

0

精彩评论

暂无评论...
验证码 换一张
取 消