可以使用哪个控件来显示动态表单(具有各种类型的数据)?

发布于 2024-12-13 16:47:40 字数 513 浏览 2 评论 0原文

我面临以下问题:

  • 我们有项目的元数据,每个项目可以是不同类型的 NSControl,目前是 NSTokenField 和 NSTextField,但我们可能需要 NSCombo 或其他类型。 我需要构建一个表单,其中每个条目都有一个标签和一个可编辑控件。 由于项目是从服务器检索的,因此必须动态构建此表单。

我已经用 NSMatrix 实现了它,除了看起来很破旧之外,我还面临着一些我不知道如何解决的视觉问题。

视觉问题是每次我将鼠标移到 NSTextFieldCell 上时,标记都会绘制在 NSMatrix 表单的左上角。

现在,我正在考虑转向另一种类型的控件,

我用谷歌搜索了几个小时,找到了以下控件: NS表格, NSMatirx(NSForm 的父级), NSCollectionView, NSTableView

其中哪一个最适合这项任务?

我希望我很清楚,因为我想添加图片,但由于缺乏“信​​誉点”,它不允许我添加。

感谢您的帮助, 埃亚尔。

I'm facing the following problems:

  • We have meta data for items, each item can be a different type of NSControl, currently NSTokenField and NSTextField, but we might need NSCombo or other types.
    I need to build a form in which each entry will have a label and an editable control.
    this form has to be built dynamically since the items are retrieved from the server.

I've implemented it with NSMatrix, and apart from it looking pretty shabby, I'm faced with some visual issues I don't know how to solve.

The visual issue is every time I move the mouse over the NSTextFieldCell the tokens get drawn on the top left corner of the NSMatrix form.

now, I'm considering moving to another type of control,

I've googled for few hours, and found the following controls:
NSForm,
NSMatirx (parent of NSForm),
NSCollectionView,
NSTableView

which one of these is the most appropriate for this task?

I hope I am clear since I wanted to add pictures, but it wouldn't let me due to lack of "reputation points".

Thanks for your help,
Eyal.

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

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

发布评论

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

评论(1

皇甫轩 2024-12-20 16:47:40

NSTokenFieldNSTextField 的子类,因此您可以使用 NSTableView 来显示它们。

您还可以绘制一个包含所有元素的自定义 NSCell。当每个“项目”具有不同数量元素时,情况会变得更加复杂。

NSTokenField is a subclass of NSTextField so you could use an NSTableView to display them.

You could also draw a custom NSCell with all elements in it. When each "item" has a different number of elements then this becomes a bit more complicated though.

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