ArduinoMenu icon indicating copy to clipboard operation
ArduinoMenu copied to clipboard

Using macros and custom strings

Open ACuppaJoes opened this issue 4 years ago • 2 comments

Hello

I was wondering if it was possible to use my own strings to later edit using the Edit macro. I would essentially like to be able to select a preset and also rename it using the menu. When I try to compile this code it, the compiler tells me "array must be initialized with a brace-enclosed initializer"

Does the SELECT macro not allow arguments pointing to custom strings?

const char* constMEM alphaNum MEMMODE=" 0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,\\|!\"#$%&/()=?~*^+-{}[]€";
const char* constMEM alphaNumMask[] MEMMODE={alphaNum};


String cust1="Custom 1";
String cust2="Custom 2";
String cust3="Custom 3";

int selPreset=0;
SELECT(selPreset,selPre,"Preset",doNothing,noEvent,wrapStyle
  ,VALUE(cust1,4,doNothing,noEvent)
  ,VALUE(cust2,5,doNothing,noEvent)
  ,VALUE(cust3,6,doNothing,noEvent)

ACuppaJoes avatar Aug 17 '21 11:08 ACuppaJoes

I was wondering something similar for FIELD objects "string" param.

For instance trying to use an extended ASCII character for a menu text:

I get "initializer fails to determine size of 'fieldLabel14'. My guess is because the macro is determining the size of the character array?

char* arrowUp = 30;

MENU(mainMenu, "Settings", doNothing, noEvent, wrapStyle
     , FIELD(dwellTop, arrowUp, " s", 5, 30, 1, 1, adjustDwellTop, enterEvent, wrapStyle)
     , EXIT("<  Sleep")
    );

polygonfuture avatar Sep 16 '21 21:09 polygonfuture

I don't think he checks the issues section regularly. I still haven't received a response but I am going to play around with the Target example. I think it might help us resolve this issue

ACuppaJoes avatar Sep 18 '21 02:09 ACuppaJoes