NSTextField 和 NSComboBox 在 Lion 中绘制方式不同

发布于 2024-11-29 04:03:18 字数 621 浏览 8 评论 0原文

我有一个在 Snow Leopard 下开发的数据表单,其中有 NSTextField 框和 NSComboBox 字段,这在 Snow Leopard 下看起来很好,但现在在 Lion 中,它们'重新绘制略有不同。我还有一些带有边框按钮的 NSComboBox 字段,还有一些带有无序按钮的字段,这些字段也不匹配(尽管边框按钮 NSComboBox 看起来很接近NSTextField,尽管它也不匹配。

我怎样才能让所有内容和谐匹配?我很乐意让 NSTextField 像组合框一样自动完成,因为我隐藏了无论如何,

无边框 NSComboBox 左,NSTextField 右(不同的上边缘):

Non-Bordered Combo vs. Text Field

有边框 NSComboBox 左,NSTextField` 右(不同高度):

边框组合与文本字段

I've got a data form I developed under Snow Leopard, that has NSTextField boxes alongside NSComboBox fields, and this looked fine under Snow Leopard, but now in Lion, they're drawn slightly differently. I also have some NSComboBox fields with a bordered button, and some with an unordered button, and these don't match, either (though the bordered button NSComboBox looks close to the NSTextField, though it's not a match, either.

How can I get everything to harmoniously match? I'd be happy to get an NSTextField to autocomplete like a combo box, since I hide the button anyway.

Non-Bordered NSComboBox left, NSTextField right (different top edge):

Non-Bordered Combo vs. Text Field

Bordered NSComboBox left,NSTextField` right (different heights):

Bordered Combo vs. Text Field

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

芸娘子的小脾气 2024-12-06 04:03:18

我最终用 NSTextField 控件替换了无边框组合框(我一直隐藏按钮),使用此处的方法:NSTextField 自动完成

我稍微修改了一下:

- (void)controlTextDidChange:(NSNotification *)obj {
    if (!isAutoCompleting) {
        isAutoCompleting = YES;
        [[[obj userInfo] objectForKey:@"NSFieldEditor"] complete:nil];
        isAutoCompleting = NO;
    }
}

当我希望 NSComboBox 按钮可见时,我使用边框样式,它匹配得足够紧密。

I ended up replacing my non-bordered combo boxes (for which I had been hiding the buttons) with NSTextField controls, using the method here: NSTextField AutoCompletion.

I modified it slightly:

- (void)controlTextDidChange:(NSNotification *)obj {
    if (!isAutoCompleting) {
        isAutoCompleting = YES;
        [[[obj userInfo] objectForKey:@"NSFieldEditor"] complete:nil];
        isAutoCompleting = NO;
    }
}

When I want the NSComboBox button to be visible, I use the bordered style, which matches closely enough.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文