右键菜单 GenericMenu
2014-10-20 14:49
148 查看
http://www.cnblogs.com/zhaoqingqing/p/3799294.html
自定义窗口中使用右键菜单:
// This example shows how to create a context menu inside a custom EditorWindow. class MyGenericMenu extends EditorWindow { @MenuItem("Game/Open Window") static function Init () { var window = GetWindow (MyGenericMenu); window.position = Rect (50, 50, 250, 60); window.Show (); } function Callback (obj:Object) { Debug.Log ("Selected: " + obj); } function OnGUI() { var evt : Event = Event.current; var contextRect : Rect = new Rect (10, 10, 100, 100); if (evt.type == EventType.ContextClick) { var mousePos : Vector2 = evt.mousePosition; if (contextRect.Contains (mousePos)) { // Now create the menu, add items and show it var menu : GenericMenu = new GenericMenu (); menu.AddItem (new GUIContent ("MenuItem1"), false, Callback, "item 1"); menu.AddItem (new GUIContent ("MenuItem2"), false, Callback, "item 2"); menu.AddSeparator (""); menu.AddItem (new GUIContent ("SubMenu/MenuItem3"), false, Callback, "item 3"); menu.ShowAsContext (); evt.Use(); } } } }
相关文章推荐
- [cb]右键菜单 GenericMenu
- PyQt按钮右键菜单
- [右键]如何添加Sublime为右键菜单
- QT-输入框右键菜单翻译文件安装
- jQuery插件(表单验证/表单返值/灯箱/图片放大/cookie/自动匹配/右键菜单/选中变色/相加相减)
- HTML5里原生的右键菜单创建方法
- 解决双击文件打开很慢,右键菜单也慢
- Datagridview加右键菜单功能
- 添加系统右键菜单
- 显示EAS标准单据自带kdtable(kdtEntry) 右键导出 excel菜单
- Flash player自定义右键菜单
- Win7鼠标右键菜单跑到鼠标箭头的左侧去怎么改回到右边
- Developer Express右键菜单显示汉化
- 成功解决在Python文件上右键菜单无“Edit with IDLE”选项
- 为EXT tree 树菜单添加右键菜单时出现重复菜单问题
- Ext教程连载 - 带右键菜单的树
- 自定义UNIFORM的右键菜单
- FLEX4 屏闭系统右键菜单列表控件DataGrid/Tree/List上点右键时自动选择当前行
- 删除右键菜单中多余项的常用方法
- 更新Svn客户端后,右键菜单中没有TortoiseSVN了