You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to design a custom MUI field which shold draw a status bar on a given coordinate. I'm passing the x and y coordinates, width as arg (not sure if it's intended to work this way) and a text string, all using MUI_XYAT.
Actually, I'm able to get X and Y using mui_get_x(ui) and mui_get_y(ui). I don't know how to get the width value. The text is only shown if:
a) manually set the font with u8g2_SetFont, which has the inconvenience of changing the fonts of the entire form, and
b) manually passing the string to u8g2_DrawUTF8 function. I have tried ui->text, without success.
Edit: it was just dumb me at 3:00 AM making a mistake with IDs (R1/L1). Now I just need to know how to get the arg from XYAT with the width.
muif_t muif_list[] = {
MUIF_U8G2_FONT_STYLE(0, u8g2_font_NokiaSmallBold_tf),
MUIF_U8G2_FONT_STYLE(1, u8g2_font_VCR_OSD_tn),
MUIF_RO("R1", mui_u8g2_draw_statusbar)
};
fds_t fds_data[] =
MUI_FORM(1)
MUI_STYLE(0)
MUI_XYAT("L1",65, 42, 20, "SENSORES")
//MUI_LABEL(0, 55, "SENSORES:")
;
uint8_t mui_u8g2_draw_statusbar(mui_t *ui, uint8_t msg)
{
u8g2_t *u8g2 = mui_get_U8g2(ui);
switch(msg)
{
case MUIF_MSG_DRAW:
u8g2_DrawRBox(u8g2, mui_get_x(ui), mui_get_y(ui), 128, 16, 3);
u8g2_SetDrawColor(u8g2, 0);
u8g2_SetFont(u8g2, u8g2_font_NokiaSmallBold_tf); //how can I get the form style?
u8g2_DrawUTF8(u8g2, mui_get_x(ui)+5, mui_get_y(ui)+10, "SOME TEXT"); //how to get the string from MUI_XYAT?
u8g2_SetDrawColor(u8g2, 1);
break;
case MUIF_MSG_FORM_START:
break;
case MUIF_MSG_FORM_END:
break;
case MUIF_MSG_CURSOR_ENTER:
break;
case MUIF_MSG_CURSOR_SELECT:
break;
case MUIF_MSG_VALUE_INCREMENT:
break;
case MUIF_MSG_VALUE_DECREMENT:
break;
case MUIF_MSG_CURSOR_LEAVE:
break;
case MUIF_MSG_TOUCH_DOWN:
break;
case MUIF_MSG_TOUCH_UP:
break;
}
return 0;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
I'm trying to design a custom MUI field which shold draw a status bar on a given coordinate. I'm passing the x and y coordinates, width as arg (not sure if it's intended to work this way) and a text string, all using MUI_XYAT.
Actually, I'm able to get X and Y using mui_get_x(ui) and mui_get_y(ui). I don't know how to get the width value. The text is only shown if:
a) manually set the font with u8g2_SetFont, which has the inconvenience of changing the fonts of the entire form, and
b) manually passing the string to u8g2_DrawUTF8 function. I have tried ui->text, without success.
Edit: it was just dumb me at 3:00 AM making a mistake with IDs (R1/L1). Now I just need to know how to get the arg from XYAT with the width.
Beta Was this translation helpful? Give feedback.
All reactions