Oracle Forms Builder - 切换到另一种形式的窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10253988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:44:30  来源:igfitidea点击:

Oracle Forms Builder - change to window in another form

oracleoracle10goracleforms

提问by rluks

We have two forms so far, and need to switch from window1 in from1 (which is login screen) to windowX in formX using button (trigger code below):

到目前为止,我们有两个窗体,需要使用按钮(触发代码如下)从 from1 中的 window1(即登录屏幕)切换到 formX 中的 windowX:

begin
  show_window('windowX');
  go_block('some_block_in_formX');
end;

This gives error FRM-41052: Cannot find Window: invalid ID

这会产生错误 FRM-41052:找不到窗口:ID 无效

So question is, should I add formX into show_window parameter in certain way or is there another approach? Thank you.

所以问题是,我应该以某种方式将 formX 添加到 show_window 参数中还是有另一种方法?谢谢你。

Please note, that forms are in different files.

请注意,表格位于不同的文件中。

回答by Sathyajith Bhat

that forms are in different files.

表格在不同的文件中。

If the forms are different files, you need to call the other form using open form/call form/newform- whatever suits your needs.

如果表单是不同的文件,您需要使用open form/call form/newform调用另一个表单- 任何适合您的需要。

show_window/go_blocksequence can be used only when you're moving to different windows/blocks of the sameform - and the error message

show_window/go_block仅当您移动到相同形式的不同窗口/块时才能使用序列- 以及错误消息

error FRM-41052: Cannot find Window: invalid ID

错误 FRM-41052:找不到窗口:ID 无效

is complaining that it can't go to that Window because it's in a differentform.

抱怨它不能去那个窗口,因为它的形式不同

回答by Jeffrey Kemp

Each form effectively has a private namespace for all its windows, blocks, items, etc - and your code always runs within the context of a single form.

每个表单实际上都有一个用于其所有窗口、块、项目等的私有命名空间 - 您的代码始终在单个表单的上下文中运行。

To solve this, you'll need a form parameter, plus some code in the other form, e.g.:

要解决这个问题,您需要一个表单参数,以及其他表单中的一些代码,例如:

  1. in formX, add a parameter ACTION
  2. in form1, pass the value 'XYZ' to ACTION
  3. in formX, in the WHEN-NEW-FORM-INSTANCEtrigger, check if :PARAMETER.ACTION = 'XYZ', and if so, do your show_window and go_block. Copy the same code to your WHEN-WINDOW-ACTIVATEDtrigger.
  1. 在formX中,添加一个参数ACTION
  2. 在 form1 中,将值 'XYZ' 传递给 ACTION
  3. 在 formX 中,在WHEN-NEW-FORM-INSTANCE触发器中,检查是否:PARAMETER.ACTION = 'XYZ',如果是,则执行 show_window 和 go_block。将相同的代码复制到WHEN-WINDOW-ACTIVATED触发器中。

Of course, you'll need to think about the name of the parameter (e.g. ACTION) and value ('XYZ') that will make sense to people maintaining your forms in the future.

当然,您需要考虑参数的名称(例如 ACTION)和值('XYZ'),这对将来维护表单的人有意义。