MULTIEDIT and GUI_FONT_8X16X2X2

  • Hi folks,
    I have a MULTIEDIT which I have set to use font GUI_FONT_8X16X2X2. It seems like the Window only displays half the text it is capable of showing. In other words, if I size the MULTIEDIT to display four lines of text, it only shows the first two. If I enable vertical scroll bar, I can scroll up and down and see all four lines scrolling through the first two lines of the display.

    (*) I am writing a single text string to the MULTIEDIT using MULTIEDIT_SetText() which contains three embedded '\n' characters. I am doing something similar with another MULTIEDIT and using the GUI_FONT_20_1 font and getting all possible lines displayed.

    Is there a work around for this problem?

    Thanks!

  • Hi Adian,
    The code file is generated using the GUI builder tool.

    Creation is via an entry in _aDialogCreate[]

    Code
    static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 800, 0, 0x0, 0 },  { IMAGE_CreateIndirect, "Image", ID_IMAGE_0, 0, 0, 180, 68, 0, 0, 0 },  { MULTIEDIT_CreateIndirect, "Multiedit", ID_MULTIEDIT_0, 10, 692-ENLARGE, 460, 48+ENLARGE, 0, 0x0, 0 },
    ...



    Initialization in _cbDialog()

    Code
    switch (pMsg->MsgId) {  case WM_INIT_DIALOG:    SCROLLBAR_SetDefaultWidth(20);    //    // Initialization of 'Multiedit'    // bottom MULTIEDIT (status area)to read only:    //#if MULTIEDIT_WORKS    hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIEDIT_0);    statusWinHandle = hItem;    MULTIEDIT_SetText(hItem, "");    MULTIEDIT_SetFont(hItem, GUI_FONT_8X16X2X2);//    MULTIEDIT_SetFont(hItem, GUI_FONT_8X18);    MULTIEDIT_SetReadOnly(hItem,true);      MULTIEDIT_SetAutoScrollH(hItem, true);            // turn on horizontal auto-scroll    MULTIEDIT_SetAutoScrollV(hItem, true);            // turn on vertical auto-scroll



    (The SetAutoScroll calls are not necessary to provoke the problem but vertical scrolling us useful to visualize the situation.)

    There is no 'notification' processing for this widget.

    The widget is sized to hold four lines of text and the text is written using

    Code
    MULTIEDIT_SetText( statusWinHandle, statusBuf);          // write to the screen

    where statusBuf is a char array and would contain something that looks like "line1\nline2\nline3\nline4"

    I suspect that somewhere the font vertical dimensions is getting doubled twice when determining how much of the text in the buffer is visible on the display.

    Is this enough information? (Apologies for the one liners in the code snippets. They did not look that way when pasted into the edit window...)

    Thanks!

    Edited once, last by hbarta (August 4, 2015 at 4:30 PM).

  • Hello,

    Thank you for sending the code. I was able to reproduce the problem. It is caused, because the y-spacing of the font is not correctly calculated for magnified fonts. This will be fixed in the next emWin version.

    Best regards,
    Adrian

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!