popupMenuXY()
Opens a pop-up menu in a specific position.
Synopsis
int popupMenuXY(dyn_string text, int x, int y, int &answer [, string font
[, string forecol [, string backcol]]]);
Parameter
Parameter | Description |
---|---|
text | Structure of the menu, see below |
x | X position of the menu (screen coordinates) |
y | Y position of the menu (screen coordinates) |
answer | Return variable |
font |
Font type of the pop up e.g.
|
forecol | Foreground color, for example, string forecolor = "{255,255,255}"; |
backcol | Background color, for example, string backcolor = "{0,153,153}"; |
Return value
In case of an error, the function returns -1 otherwise, 0.
Error
Missing or wrong parameters.
Description
Opens a pop-up menu in a specific position. The position is specified by screen coordinates. For how to set, for example, a separating line, see popupMenu().
Example
For the following example, add a list to your panel. Add the following script to the "RightMousePressed" event of the list. Click the list in the module VISION to open a pop-up menu with the specified entries in the position 50, 50. The second example shows a pop-up menu (position 0,0) where the font as well as the foreground and background colors will be set.
main() { dyn_string txt; int answer, x, y; int x = 50; int y = 50; txt=makeDynString("PUSH_BUTTON, text1, 1, 1", "PUSH_BUTTON, text2, 2, 1", "SEPARATOR", // Separating line "CASCADE_BUTTON, Ebene 2, 1", "PUSH_BUTTON, text3, 3, 1", "Ebene 2", // level 2 "PUSH_BUTTON, text4, 4, 0", "PUSH_BUTTON, text5, 5, 1"); popupMenuXY(txt, x, y, answer); if(answer == 1) // The return value DebugN("Text1"); else DebugN("Text2"); }
main() { dyn_string txt; int answer, x= 0,y=0; string s, font, forecolor, backcolor; txt=makeDynString("PUSH_BUTTON, text1,1,1", "PUSH_BUTTON, text2,2,1", "SEPARATOR", // Separator "CASCADE_BUTTON, Ebene 2,1", "PUSH_BUTTON, text3,3,1", "Ebene 2", // begin of level 2 "PUSH_BUTTON, text4,4,1", "PUSH_BUTTON, text5,5,1"); font = "Courier New,-1,19,5,75,1,0,0,0,0"; //Font forecolor = "{255,255,255}"; //foreground color backcolor = "{0,153,153}"; //background color int result = popupMenuXY(txt,x,y,answer,font,forecolor,backcolor); switch(answer) { case 1: DebugN("text1"); break; case 2: DebugN("text2"); break; case 3: DebugN("text3"); break; case 4: DebugN("text4"); break; case 5: DebugN("text5"); break; default: break; } }
Assignment
Graphics functions
Availability
UI