GUI 构建器的 OO 模式
对于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个小部件都需要支持一个用于获取小部件选项的界面。
例如,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.