Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » How change BaseDialog height.

Author: chirrindulari
07/03/2021 11:57:05
Hi Dave.

I have a display with two colors. The first 16 lines are yellow and the rest are blue. Also there is a gap between the two zones.

All the menus are presented fine, because the title in inverse seems to have an height of 14 pixels. See photo "menu.jpg".

When a BaseDialog is presented, the height of the title ( dlg->show ) seems to have 12 pixels. When a second line text is presented wit dlg->copyIntoBuffer, it is mixed between yellow and blue. Also a separation between the two colors makes the text to be "broken". See photo "Dialog.jpg"

I think one possible solution is to change the "title" (dlg->show) haight from 12 to 14 or maybe 16. Is it possible?



Alternatively, how can I send a Carriage Return in dlg->copyIntoBuffer to not use that fisrst line and be sure to be only on the blue zone? I've tried to send "\n" but with no luck.

Thanks a lot.



Code use to make Dialog.jpg photo

const char allSavedPgm[] PROGMEM = "Salvando Configuracion...";

void CALLBACK_FUNCTION fnSalvar(int id) {
    BaseDialog* dlg = renderer.getDialog();
    if(dlg) {
        dlg->setButtons(BTNTYPE_NONE, BTNTYPE_CLOSE);
        dlg->show(allSavedPgm, false); // false = shows only on device
        dlg->copyIntoBuffer("...");
        dlg->copyIntoBuffer("Salvada !");
    }
}

[Thumb - Menu.jpg]
Filename Menu.jpg
Description No description given
Filesize 288 Kbytes
Downloaded 54505 time(s)
[Disk] Download

[Thumb - Dialog.jpg]
Filename Dialog.jpg
Description No description given
Filesize 194 Kbytes
Downloaded 54006 time(s)
[Disk] Download


Author: davetcc
08/03/2021 07:42:18
Hi there,

I just had a look at the code, I think there's a very simple fix for this until tcMenu2.0 comes out. This is because in 2.0 dialogs are made up of menu items so render exactly the same.

I'm assuming U8G2 here.

For now open tcMenuU8g2.cpp in your project (it was put there by the designer), and search for void the following text: U8g2Dialog::internalRender(int currentValue)

Now you are in the function that draws the menu, until 2.0 gets a bit further along, I suggest that around line 321, the wrong font is being used to draw the title, the line looks like:

graphics->setFont(gfxConfig->itemFont);


change it to

graphics->setFont(gfxConfig->titleFont);


Also same on line 326, it's using itemPadding instead of titlePadding.

Another quick fix would be to add a bit to variable "dlgNextDraw" that you see in that method.

You'll need to repeat that change every time the generator runs, but it's quite a simple change, and tcMenu 2.0 is now just around the corner basically.

Author: chirrindulari
08/03/2021 21:53:36
Thanks Dave.

Actually, maybe you finish tcMenu 2.0 before I finish my program. But now I understand a bit better the library.




Register / Login  |  Desktop view  |  Jump to top of page