MULTIEDIT - I think there is a bug!

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • MULTIEDIT - I think there is a bug!

    Hi,

    I am introducing the MULTIEDIT widget in my application (Keil emWin Lib). It is used to display device error strings. Since there can be several errors I want the multiedit widget to append every new error string at the end of the displayed text in a new line. I also want the SCROLLBAR widget to signalize when there are more errors that can be displayed on the screen. In order to check the error history I want to scroll up and down through the entries of the MULTIEDIT widget. Therefore I use a rotary encoder which sends the corresponding keyboard codes (GUI_KEY_UP and GUI_KEY_DOWN) to the widget. Last but not least I want the widget to wrap long strings in word mode.

    I create the widget with the following attributes: MULTIEDIT_CreateIndirect, ..., MULTIEDIT_CF_READONLY | MULTIEDIT_CF_AUTOSCROLLBAR_V
    Further on I enable the Word Wrap Mode in the WM_INIT_DIALOG case: MULTIEDIT_SetWrapWord(Item);


    At the first sight the application seemed working fine. I can add strings to the end of the widget and scroll up and down the cursor as long as the scrollbar is hidden.
    But just after the scrollbar appears (with the next error entry) the desired error string is displayed but I cannot scroll the widget anymore although the keyboard messages are sent to the widget.

    I did some tests and figured out that my application works as expected if I either disable the AUTOSCROLLBAR or the WordWrapMode.
    Both functions enabled does not work!

    There was a post in January 2013 which seems to address the same problem: MULTIEDIT seems not work correctly in wrap mode

    I think this behavior is a malfunction. Can you please check this issue?


    regards
    Thomas



  • Hi,

    unfortunately we could not reproduce any problem. Here is our test:

    C Source Code

    1. #include "MULTIEDIT.h"
    2. void MainTask(void) {
    3. int i;
    4. char acBuffer[] = "Test 00 ";
    5. WM_HWIN hWin;
    6. GUI_Init();
    7. hWin = MULTIEDIT_CreateEx(10, 10, 100, 100, 0, WM_CF_SHOW, MULTIEDIT_CF_READONLY | MULTIEDIT_CF_AUTOSCROLLBAR_V, 0, 1000, "");
    8. MULTIEDIT_SetWrapWord(hWin);
    9. for (i = 0; i < 80; i++) {
    10. acBuffer[5] = '0' + i / 10;
    11. acBuffer[6] = '0' + i % 10;
    12. MULTIEDIT_AddText(hWin, acBuffer);
    13. }
    14. while (1) {
    15. for (i = 0; i < 20; i++) {
    16. MULTIEDIT_AddKey(hWin, GUI_KEY_UP);
    17. GUI_Delay(200);
    18. }
    19. for (i = 0; i < 20; i++) {
    20. MULTIEDIT_AddKey(hWin, GUI_KEY_DOWN);
    21. GUI_Delay(200);
    22. }
    23. }
    24. }
    Display All


    It creates a MULTIEDIT using word wrap and a vertical AUTOSCROLLBAR filled with a couple of words. It then sends multiple up- and down keys to the widget. It works fine.

    Regards, Jörg
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Jörg,

    thank you for your response.
    I checked your code and can confirm that it is working.
    Meanwhile I dug deeper in my code and spent all the time up to now to find the reason for this behavior.
    Now I found a workaround that works in my case.
    I have to set the cursor to the right position in the MULTIEDIT widget (which is MULTIEDIT_SetCursorOffset(Item, MULTIEDIT_GetTextSize(Item) - 1)) before adding the new text with MULTIEDIT_AddText(Item, ErrBuf);.
    I don't know exactly why but i suppose that it has something to do with the line feed "\n" which I append to every single string.

    Anyway thank you for your time.
    regards Thomas