PxPlus User Forum

Twitter Twitter Twitter

Author Topic: construct popup menu  (Read 222 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 133
    • View Profile
construct popup menu
« on: April 19, 2021, 05:58:42 AM »
In some programs we use user data in popup menus. In order to avoid an error 87 we strip out/replace all theses characters: [{,}]
This often leads to disscussions concerning the wrong display of their data.
Can you please allow for escaping these characters or provide an up to date API for constructing a menu?

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3457
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: construct popup menu
« Reply #1 on: April 19, 2021, 11:05:52 AM »
One of the issues we have with providing an escape sequence for the characters is that the character often used is back slash.  Of course that causes problems due to the fact that Windows uses this as a directory delimiter meaning directory structures could be problematic.

Now there is a way you can likely show the brackets and braces and commas in a menubar if you are using UTF8 encoding:

Replace the following:

{ - with Unicode 10100 / x2774 which is ❴
} - with Unicode 10101 / x2775 which is ❵
[ - with Unicode 10637 / x298D which is ⦍
] - with Unicode 10638 / x298E which is ⦎
, - with Uncode 65292 / xFF0C which is ,


This could be done with a TRANSLATE statement similar to:

TRANSLATE TEXT$,"{"+CHR(3)+CVS(10100)+"}"+chr(3)+CVS(10101)+...

There are many UNICODE characters that will look similar and when running in UTF-8 mode could be substituted in the text and the user would not likely notice the difference.

Going forward (Not PxPlus 2021 due to timing of request) we may look at providing alternative escape codes such as:

  • Instead of { } use $01$,$02$
  • For the data between [ ] use a line feed to separate groups
  • Instead of a comma use a TAB
  • Instead of a = use an ESC or $00$

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3457
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: construct popup menu
« Reply #2 on: April 22, 2021, 02:41:13 PM »
Just a quick update on this topic.  We managed to find some time and for PxPlus 2021 we have added an escape option for the Menu_bar and Popup_Menu directives.

If the text you want to include has any of the characters used to define the menu, that is {, }, [, ], = or comma; you will need to escape these characters with the backslash and put  a backslash as the first character of the menu definition string to indicate that you have escapes in the text.

For example. If you wanted an entry in the menu bar to read "Export [to Word]" your menu_bar command would look like this:

MENU_BAR 120,"\[&File],F:[&Open,,&Save,&Export \[to Word\],&Quit=4]"
POPUP_MENU @(col,row),"\[&File],F:[&Open=1,,&Save,&Export \[to Word\]=2,&Quit=4]",X


The first character of the menu bar definition string being a back slash indicates to the system that the menu contains escaped characters.  Any subsequent character in the string preceded by a backslash will be not be considered as a delimiter/control character and included in the menu text.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 133
    • View Profile
Re: construct popup menu
« Reply #3 on: April 23, 2021, 01:49:20 AM »
That sounds good. Thank you.