[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

How change BaseDialog height. RSS feed
Forum Index » tcMenu Arduinio library
Author Message
chirrindulari


Joined: Jan 23, 2021
Messages: 22
Offline
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 [Disk] Download
 Description No description given
 Filesize 288 Kbytes
 Downloaded:  54505 time(s)

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

davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
chirrindulari


Joined: Jan 23, 2021
Messages: 22
Offline
Thanks Dave.

Actually, maybe you finish tcMenu 2.0 before I finish my program. But now I understand a bit better the library.
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.