Build your own context menu on Form field.

Context menu on field are nothing but the list of features shown when you do right click on field like filter by field,by selection ,setup etc.
Following code illustrates how you can override the standard context menu and build your own .
Best use of this is in-case of display methods where filter by field and selection are not available.
Override the standard context method available on Form fields.

public void context()

PopupMenu menu ;
Str filterValue;
int selectedItem;
int filter, removeFilter;

//super(); // Comment standard menu

menu = new PopupMenu(element.hWnd());
filter = menu.insertItem("Filter");
removeFilter= menu.insertItem("Remove Filter");

selectedItem = menu.draw();
filterValue ="Table1_Usn").valueStr();

switch (selectedItem)
case filter :

case removeFilter :


For illustration i have used my own objects , So please test with your own valid objects.


  1. Hi,How can I add a new ıtem ın the standart context menu ??? this code make new context menu.

  2. Hi Antiope,

    Please try the above code. If it doesn't help please let me know.


Note: Only a member of this blog may post a comment.