Flex - 如何获取自定义网格列过滤器编辑器的父级并打开弹出窗口?

发布于 2024-12-29 18:22:42 字数 1069 浏览 0 评论 0原文

我试图弄清楚如何在我的 Air 应用程序中打开一个弹出窗口,在辅助窗口中,而不是在主应用程序窗口中。

我正在使用 ReusableFX 组件,其中包括具有过滤和其他功能的自定义 DataGrid。当您单击网格中列的顶部时,过滤功能会通过 PopUpManager 显示一个弹出窗口。

PopUpManager.addPopUp(this, FlexGlobals.topLevelApplication as DisplayObject);

问题是弹出窗口在主应用程序中打开 - 我假设是因为“topLevelApplication”引用。

所以,我需要一种方法在当前的Air“s:Window”中打开这个窗口。

我假设我需要一种方法来走上去: this.parent.parent 或 this.owner.owner - 尽管我已经尝试过,但它似乎不起作用(它说空引用)。

或者,有没有办法获取当前最顶层的窗口/组件(不是主应用程序/窗口)?

更新: 我决定为该组件创建一个新项目,并添加到 Air 库中。现在我可以访问“NativeApplication.nativeApplication.activeWindow”调用。这给了我正确的空气窗口。但是,它似乎不起作用:

PopUpManager.addPopUp(this, NativeApplication.nativeApplication.activeWindow as DisplayObject);

我的弹出窗口没有出现。我假设是因为“activeWindow”实际上不是 DisplayObject? (那么如果是这种情况我如何获取 DisplayObject?)

更新: 难道我是 这个 adobe bug 的受害者吗? (最初在这里找到

I am trying to figure out how to open a pop up window in my Air application, in a secondary Window, instead of the main application window.

I am using the ReusableFX components, which include a custom DataGrid with filtering and other capabilities. The filtering feature displays a pop up window via PopUpManager when you click on the top of a column in the grid.

PopUpManager.addPopUp(this, FlexGlobals.topLevelApplication as DisplayObject);

The problem is that the pop up window opens in the main application - I am assuming because of the 'topLevelApplication' reference.

So, I need a way to open this window in the current Air "s:Window".

I am assuming I need a way to walk up : this.parent.parent or this.owner.owner - though I have tried that and it did not seem to work (it said null reference).

OR, is there a way to get the current top most window / component (NOT the main application / window)?

Update:
I decided to create a new project for the component, and add in the Air libraries. Now I am able to access the "NativeApplication.nativeApplication.activeWindow" call. That gives me the correct Air window. However, it does not seem to be working:

PopUpManager.addPopUp(this, NativeApplication.nativeApplication.activeWindow as DisplayObject);

My popup does not appear. I am assuming because "activeWindow" is not actually a DisplayObject? (so how do I get the DisplayObject if that's the case?)

Update:
Could it be that I am a victim of this adobe bug? (found here originally)

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

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

发布评论

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

评论(1

口干舌燥 2025-01-05 18:22:42

好吧,我想出了一些似乎有效的更改,尽管可能有一种更简洁的方法来做到这一点 - 我只是无法找到一种方法来获取对当前空气应用程序窗口的引用,除了这种方式(这是顺便使用 ReuableFX 自定义 Flex 组件):

首先,在我的自定义 DataGridColumn 组件中,我添加了一个公共属性

public var pApp:Object;

接下来,我修改了 DropDownFilterHeaderRenderer (扩展 HBox ,实现 IListItemRenderer)、 showFilterDropDown 方法和就在它调用 dropDown.startEdit(column); 之前,补充:

column.pApp = parentApplication;

最后,我修改了DropDownFilterEditor(扩展了FilterEditorBase),方法startEdit(column:MDataGridColumn)(之前的PopUpManager调用了FlexGlobals.topLevelApplication,在Air本机应用程序中打开as:Window时,这不是正确的窗口:

var editorInstance:Object = _editor.parent;
var columnInstance:Object = editorInstance.column;
var parAppInstance:Object = columnInstance.pApp;
PopUpManager.addPopUp(this, parAppInstance as DisplayObject);

Well, I came up with some changes that seem to work, though there is probably a much cleaner way to do this - I was just not able to figure a way to get a reference to the current air application window except this way (this is using the ReuableFX custom flex component by the way):

First, in my custom DataGridColumn component, I added a public property

public var pApp:Object;

Next, I modified the DropDownFilterHeaderRenderer (extends HBox , implements IListItemRenderer), showFilterDropDown method and right before it calls dropDown.startEdit(column); , added:

column.pApp = parentApplication;

Finally, I modified DropDownFilterEditor (which extends FilterEditorBase), the method startEdit(column:MDataGridColumn) (the previous PopUpManager was calling FlexGlobals.topLevelApplication, which is not the correct window when opening a s:Window in an Air native application:

var editorInstance:Object = _editor.parent;
var columnInstance:Object = editorInstance.column;
var parAppInstance:Object = columnInstance.pApp;
PopUpManager.addPopUp(this, parAppInstance as DisplayObject);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文