IntraWeb 表单可以按需同步吗?
场景:我有一个 Delphi Intraweb 应用程序,屏幕上有一些编辑组件和按钮。在 TIWEdit.OnAsyncExit 和 TIWButton.OnClick 中设置了一个标志,应用程序中的另一个线程根据标志和一些其他应用程序数据设置按钮的启用属性。
当设置 TIWButton.Enabled 属性时,请求已经完成,并且下一个交互被取消,因为 IW 发现内部表示和 HTML 表单不同步。它会重新同步,您必须再次单击。
我想根据需要以某种方式刷新屏幕。
- 确定两者是否同步并发出刷新的计时器在流量和计时方面存在缺陷(我可以在计时器运行之前单击按钮)。
- 如果有一个可以推送数据的方法就太好了。
- 也许 IW 有可能在不取消我刚刚提交的操作的情况下进行非保存同步。
由于我的屏幕是模型驱动构建的(我无法预测屏幕上将出现哪些组件以及组件之间的相互依赖关系是什么,即业务逻辑中的依赖关系),因此我无法添加 JavaScript 来根据用户操作启用或禁用按钮。
Scenario: I have a Delphi Intraweb application that has some edit components and buttons on a screen. In the TIWEdit.OnAsyncExit and TIWButton.OnClick a flag is set, and another thread in the application sets the enabled properties of the buttons depending on the flags and some other application data.
By the time the TIWButton.Enabled properties are set, the request has already finished and the next interaction is cancelled as IW finds out that internal representation and HTML form are out of sync. It resynchonizes and you have to click again.
I would like to refresh the screen somehow on demand.
- A timer that finds out whether the two are synchronized and issues a refresh has drawbacks in traffic and timing (I can click a button before a timer run).
- A method that could push data would be great.
- Maybe IW has a possibility to do an non-save sync without cancelling the action I just committed.
As my screens are built model driven (I cannot predict what components will be on the screen and what the interdependencies between components are, that is in the business logic), I cannot add JavaScript to enable or disable a button depending on user actions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不完全确定你的问题是否与我的相同,但我认为有很多共同点。请参阅我在 Intraweb 论坛中发布的演示项目 (v2)。
根据 Jackson Gomes 的一些评论,我在长时间运行的线程启动之前启用 TIWTimer,并在线程结束后禁用它。请参阅:http://forums3.atozed.com/IntraWeb.aspx (atozedsoftware.intraweb.附件),线程“通过线程更新 IWLabel”,2009 年 10 月 15 日。OnASync
计时器事件每 500 毫秒触发一次,并使用一些带宽。在我的情况下可以接受(公司内网)。
格特
I am not completely sure if your question is the same as mine, yet I think there is a lot in common. See the demo project (v2) I posted in the Intraweb forum.
Based on some comments from Jackson Gomes I enable a TIWTimer before a long running thread starts and disable this after the thread has ended. See: http://forums3.atozed.com/IntraWeb.aspx (atozedsoftware.intraweb.attachments), thread 'IWLabel update via Thread', Oct 15, 2009.
The OnASync timer event is fired every 500 ms and is using some bandwith. Acceptable in my situation (company intranet).
Gert
您可以使用 IWElite 组件包中的 Interop Web 模块。
本质上,您可以使用 XMLHTTPRequest (XHR) 对象编写一些 Javascript 来调用 IW 应用程序的 Web 模块操作,该操作会在处理完成时返回。如果您需要 IW 应用程序在进程运行时继续正常运行,您的 Javascript 可以打开一个进度窗口并从那里进行 XHR 调用。
IW 精英可以在这里找到:
http://code.google.com/p/iwelite/
XHR 请求将如下所示像这样:
上面的代码将阻塞并等待响应。如果您希望它异步运行,您可以执行以下操作:
You could use the Interop Web Module from the IWElite component pack.
Essentially you would write a bit of Javascript using the XMLHTTPRequest (XHR) object to call into your IW app's Web Module Action which returns when the processing is finished. If you need your IW app to continue to function as normal while the process is running, your Javascript could open a progress window and make the XHR call from there.
IW Elite can be found here:
http://code.google.com/p/iwelite/
An XHR request would look something like this:
The above code will block and wait for the response. If you would rather have it act asynchronously, you could instead do the following: