<?xml version="1.0" encoding="utf-8"?>
<gui:RCPModule xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:gui="cn.smartinvoke.gui.*"
xmlns:rcp="cn.smartinvoke.rcp.*"
layout="vertical" creationComplete="init()" horizontalAlign="center" verticalAlign="middle">
<mx:Script>
<![CDATA[
import cn.smartinvoke.smartrcp.gui.FlashViewer;
import cn.smartinvoke.smartrcp.gui.control.ViewManager;
import org.eclipse.swt.widgets.Display;
import cn.smartinvoke.smartrcp.gui.CMessageDialog;
import org.eclipse.swt.SWT;
import cn.smartinvoke.smartrcp.gui.module.CShellEvent;
import cn.smartinvoke.smartrcp.gui.FlashShell;
import cn.smartinvoke.RemoteObject;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import cn.smartinvoke.smartrcp.CApplication;
import cn.smartinvoke.smartrcp.gui.module.CEvent;
[Bindable]
public var listData:ArrayCollection=new ArrayCollection();
public var swfPath:String="views/ContextMenu_T.swf";
function init():void{
var baseUrl:String=CApplication.Instance.getBaseFolder();
var moduleFolder:String=baseUrl+"/views";
// Alert.show(moduleFolder);
}
private var flashShell:FlashShell;
function onOpenClick():void{
flashShell=new FlashShell(SWT.SHELL_TRIM);
flashShell.setSize(800,600);
flashShell.setText(swfPath);
flashShell.createFlashContainer(swfPath);
flashShell.addListener(CShellEvent.Event_Closed,
function (evt:CShellEvent):Boolean{
//打开信息提示框,提示用户是否退出程序
var dialog:CMessageDialog=new CMessageDialog
("信息","是否退出程序?",CMessageDialog.INFORMATION,["关闭","取消"],1);
//打开对话框
dialog.open(function (ret:int):void{
if(ret==0){//如果用户选择了关闭按钮
//关闭打开的窗口
//获取模块对应的appId
var flashViewers:ArrayCollection=
ViewManager.Instance.findFlashViewers(this.swfPath);
if(flashViewers!=null){
for each(var flashViewer:FlashViewer in flashViewers){
//获得FlashViwer的父容器FlashShell并关闭
if(flashViewer!=null){
var parent:RemoteObject=flashViewer.getParent();
if(parent!=null && parent is FlashShell){
(FlashShell(parent)).close();
}
}
}//end for
}
}
},this);
return false;
},this);
flashShell.open();
}
function onMainShellSetting():void{
if(flashShell!=null){
var mainShell:FlashShell=flashShell;
//mainShell.setText("这是主窗体"+new Date().valueOf());
mainShell.getShell().asyncCall("setMaximized",[true]);
/* mainShell.addListener(CShellEvent.Event_Closed,
function (evt:CShellEvent):Boolean{
Alert.show("fire close event");
return false;
},this); */
}
}
]]>
</mx:Script>
<mx:Panel title="本模块演示smartrcp对多窗口的支持" cornerRadius="0" paddingLeft="0"
paddingRight="0"
styleName="opaquePanel" width="100%" height="100%" layout="vertical"
horizontalAlign="center" verticalAlign="middle">
<mx:Button label="打开窗口" click="onOpenClick()"/>
<mx:Button label="最大化主窗体" click="onMainShellSetting()"/>
</mx:Panel>
</gui:RCPModule>
smartrcp的多窗口管理演示代码
最新推荐文章于 2011-09-05 22:56:49 发布
本文提供了一个使用smartrcp实现多窗口管理和主窗体最大化的示例代码,详细介绍了如何通过Script标签定义变量、函数及事件处理逻辑,以实现场景中窗口的灵活控制。
1660

被折叠的 条评论
为什么被折叠?



