4D gives you new possibilities to customize your 4D Write Pro user interface to make it perfectly fit your business application. Instead of using the default 4D Write Pro contextual menu, which is so detailed that it could become unpleasant to use, the 4D developer can create its own contextual menu, with the exact list of actions that he wants to provide.
Since 4D v16 R3, you can:
- Replace the default contextual menu with your own menu,
- Choose the actions you want to display,
- Rearrange the item order at your convenience,
- Create your own hierarchy by adding sub-menus.
You think that reproduce this menu is cumbersome and complicated? Not at all, using standard actions, it is very easy!
Download our example
If you want how to create your own contextual menu, please download our example database:
Example highlights
Below are listed the key points of the attached example database so that you know the different programming steps to build your own 4D Write Pro contextual menu:
Associate your contextual menu to 4D Write Pro area
In the 4D Write Pro object method, you associate your menu to the contextual menu of object with the Dynamic pop up menu command. In below, you have a code example:
Case of
: (Form event=On Clicked)
If (Contextual click)
Dynamic pop up menu(myMenu)
End if
End case
Create your menu
In the Form method, you can create your own menu, on the “On Load” event for example. In below, you have a code example:
Case of
: (Form event=On Load)
C_TEXT(myMenu)
createMyMenu
: (Form event=On Unload)
// release menu
RELEASE MENU(myMenu)
End case
Don’t forget to release the menu when you have finish to use it; For example on the “On Unload” event.
The createMyMenu method ……
// Create menu
myMenu:=Create menu
Add menu item
// Insert the "copy" item
APPEND MENU ITEM(myMenu;ak standard action title)
SET MENU ITEM PROPERTY(myMenu;-1;Associated standard action;ak copy)
Add an automatic sub-menu
// Insert the "fontStyle" myMenu
APPEND MENU ITEM(myMenu;ak standard action title)
SET MENU ITEM PROPERTY(myMenu;-1;Associated standard action;ak font style)
Add an customized sub-menu
// Create sub menu size
menuSubSize:=Create menu
// Insert a sub menu item
APPEND MENU ITEM(menuSubSize;ak standard action title)
SET MENU ITEM PROPERTY(menuSubSize;-1;Associated standard action;"fontSize?value=10pt")
// Associate the "menuSubSize" sub-menu to the "Size" item of myMenu
APPEND MENU ITEM(myMenu;"Size";menuSubSize)