GUI 构建器的 OO 模式

发布于 2024-12-14 01:02:37 字数 293 浏览 2 评论 0原文

对于 GUI 构建器如何与 GUI 组件交互,是否存在公认的 OO 模式或方法?

假设您有一个 GUI(最基本的是由容器和组件组成)和一个可以实时更改 GUI 的 GUI 构建器,人们会希望它们尽可能彼此隔离,对吗? ? (即,GUI独立于GUI构建器并且对GUI构建器一无所知,并且GUI构建器具有尽可能少的关于GUI及其组件的信息,以便保持灵活性)。

但是,组件如何告诉 GUI 构建器它支持哪些属性呢? GUI Builder 如何查询这些属性的值并将更新发送回组件?

这主要只是一个思想实验,所以任何见解都值得赞赏!

Is there an accepted OO pattern or methodology for how a GUI Builder should interact with GUI components?

Supposing you have a GUI (at its most basic, consisting of containers and components) and a GUI Builder that is allowed to make changes to the GUI in real-time, one would want them to be as isolated as possible from each other, right? (I.e., the GUI is independent of and knows nothing about the GUI Builder, and the GUI Builder has as little information about the GUI and its components as possible so as to remain flexible).

But then, how does a component tell the GUI Builder what properties it supports? And how does the GUI Builder query the values of those attributes and send updates back to the components?

This is mostly just a thought experiment, so any insights are appreciated!

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

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

发布评论

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

评论(1

依 靠 2024-12-21 01:02:37

每个小部件都需要支持一个用于获取小部件选项的界面。

例如,tk 工具包支持此功能。对于任何小部件,您都可以调用 configure 方法来获取所有支持的属性和值的列表。

Every widget needs to support an interface for getting at the widget options.

For example, the tk toolkit supports this. For any widget you can call the configure method to get a list of all the supported attributes and values.

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