When I call lv_btnm_get_map, it returns data in the following:
For a button:
ButtonName, tn*, n* button number
So, for example on the default
Btn1, tn1, n1, 1
What is tn* and n*?
When I call lv_btnm_get_map, it returns data in the following:
For a button:
ButtonName, tn*, n* button number
So, for example on the default
Btn1, tn1, n1, 1
What is tn* and n*?
Anyone? Buller?
Hm, I don’t really understand. Please add an example code that shows the problem.
Well here is the code that is parsing it out.
const char** m = lv_btnm_get_map_array(preview);
int lineNum = 0;
while (*m)
{
const char* p = *m;
btnStruct bs;
int i = 0;
if (p)
while (strlen(p) > 0)
{
if (p == "\n")
{
lineNum++;
i = 0;
}
else
{
std::stringstream ss;
ss << p;
switch (i)
{
case(0):
bs.btnName = ss.str();
break;
case(1):
bs.tn = ss.str();
break;
case(2):
bs.n = ss.str();
break;
case(3):
bs.btnNum = atoi(ss.str().c_str());
break;
}
bs.lineNum = lineNum;
}
i++;
p++;
}
if (bs.btnName.length() > 0)
buttons.push_back(bs);
m++;
}
Using the default map it will have:
Btn1, tn1, n1, 1 for the first button, etc
It worked for me:
lv_obj_t * btnm = lv_btnm_create(lv_scr_act(), NULL);
const char** m = lv_btnm_get_map_array(btnm);
uint8_t i;
for(i = 0; m[i][0] != '\0'; i++) {
printf("%s\n", m[i]);
}
Btn1
Btn2
Btn3
Btn4
Btn5
OMG, Im stupid… tn, n is the additional characters of the name, I was just walking the array incorrectly.
Ok, all is well now that I remembered how to program.
What I was working on is the editor for Button maps in the UI Creator. Im pretty happy with it now
It supports a preview of the editor in the window. You can add buttons to the left and right, a new line above and below, and change the options on everything. Should make it easier to make button maps.
Wow, that looks awesome!
Its getting there.