[英]Is there a way to generate windows and/or components in Ignition?
I was hoping that Ignition had a way to import/export windows to a non-binary format such as JSON or XML, but that seems not to be the case (or is there a way?).我希望 Ignition 有办法将窗口导入/导出为非二进制格式,例如 JSON 或 XML,但情况似乎并非如此(或者有办法吗?)。
Is there a way to use the script console to generate and populate a new window, or to insert components into an existing window?有没有办法使用脚本控制台生成和填充新窗口,或者将组件插入现有窗口?
This would be used for inserting templates and other components, such as navigation buttons etc.这将用于插入模板和其他组件,例如导航按钮等。
Yes, but...对,但是...
I assume here that you're referring to Vision windows.我在这里假设您指的是 Vision 窗口。 The windows are indeed binary serialized, but the underlying structure is XML.
窗口确实是二进制序列化的,但底层结构是 XML。 But getting the deserialization done programmatically is a pain and probably not worth it.
但是以编程方式完成反序列化是一件痛苦的事情,可能不值得。
You can get a feel for what this looks like by opening a Vision window in the designer, right-clicking its Root Container and choosing Copy, then pasting it into Notepad.您可以通过在设计器中打开 Vision 窗口,右键单击其 Root Container 并选择 Copy,然后将其粘贴到记事本中来感受一下它的外观。 I myself tried to find a way to do this from a module and decided it wasn't worth it.
我自己试图从一个模块中找到一种方法来做到这一点,但我认为这不值得。 For more detail, you can view that thread in the Ignition forum here .
有关更多详细信息,您可以在此处的 Ignition 论坛中查看该主题。
However, that's not really useful for generating and populating a new window.但是,这对于生成和填充新窗口并不是很有用。
To do that, you need to do some Java programming.为此,您需要进行一些 Java 编程。 Vision is Java Swing under the hood.
Vision 是底层的 Java Swing。 There are a couple ways you can dynamically build / populate a Window.
有几种方法可以动态构建/填充窗口。
Module SDK Vision Component Guide Module SDK 视觉组件指南
Vision Component Module Example 视觉组件模块示例
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.