01 public int showContextMenu(int _menuHandle)
02{
03 int ret;
04 int myItemIdx;
05
06 PopupMenu popupMenu = PopupMenu::create(_menuHandle, this.hWnd());
07 ;
08 myItemIdx = popupMenu.insertItem("Click aquí plz!!");
09
10 ret=popupMenu.draw();
11 if (ret == myItemIdx)
12 {
13 info ("Gracias");
14 }
15 return ret;
16 }
Nuestro popupMenu se inicializa con el parametro _menuHandle y el manejador del control en cuestión.
Luego, evaluamos si el menú seleccionado es el nuestro y enviamos a la pantalla un mensaje de agradecimiento.
Ahora vamos a ponerlo más interesante, haciendo que nuestro menú permita abrir el objeto en el AOT.
01 public int showContextMenu(int _menuHandle)
02 {
03 #AOT
04 int ret;
05 int myItemIdx;
06 TreeNode treeNode;
07 TreeNode treeNodeForm;
08
09 PopupMenu popupMenu = PopupMenu::create(_menuHandle, this.hWnd());
10 ;
11 myItemIdx = popupMenu.insertItem("Abrir en AOT");
12
13 ret=popupMenu.draw();
14 if (ret == myItemIdx)
15 {
16 treeNode = TreeNode::findNode(#FormsPath);
17 treeNodeForm = treeNode.AOTfindChild('TestLookUp');
18 treeNodeForm.AOTnewWindow();
19 }
20 return ret;
21 }
Y al dar clic tenemos lo siguiente
No comments:
Post a Comment