4D Blog

Home Tips Create your own contextual menu for 4D Write Pro

Create your own contextual menu for 4D Write Pro

May 10, 2017

Tips Design your menu in 4D Write Pro

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 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

4D methodIn 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

4D methodIn 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.

4D methodThe 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)

 

Discuss

Tags 4D Write Pro, UI, v16 R3, v17, Word processor

Latest related posts

  • April 28, 2025

    Tips & Tricks for your 4D Apps – April 2025 Edition

  • April 9, 2025

    Restrict data according to privileges or information saved in session storage

  • April 7, 2025

    Designing an Interactive and Dynamic Menu Bar in Qodly application

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy