Calender Dialogue mixup.

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

  • Calender Dialogue mixup.

    The Calender dialoge has some mixup erros.
    1. The manual:

    Prototype
    void CALENDAR_SetDefaultBkColor(GUI_COLOR Color, unsigned Index);

    but should be probably :

    Prototype
    void CALENDAR_SetDefaultBkColor(unsigned Index, GUI_COLOR Color);
    Also , it looks like CALENDAR_SetDefaultBkColor() is same as CALENDAR_SetDefaultColor()

    Here is my code, and the output with PC simulation:

    CALENDAR_SetDefaultFont(CALENDAR_FI_HEADER, &GUI_Font24B_ASCII);
    CALENDAR_SetDefaultFont(CALENDAR_FI_CONTENT, &GUI_Font24B_ASCII);
    CALENDAR_SetDefaultBkColor(CALENDAR_CI_WEEKEND,GUI_GREEN);
    CALENDAR_SetDefaultBkColor(CALENDAR_CI_WEEKDAY,GUI_GREEN);
    CALENDAR_SetDefaultColor(CALENDAR_CI_WEEKEND, GUI_LIGHTMAGENTA);
    CALENDAR_SetDefaultSize(CALENDAR_SI_HEADER, 50);
    CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_X, 50);
    CALENDAR_SetDefaultSize(CALENDAR_SI_CELL_Y, 50);
    hCalender = CALENDAR_Create(hBuildWin, 20,20,2015,7,4,0,65000,0);

    How to change the background? can give an example callback function to draw a rectangle around the calender?

    Thanks
    Johanan
    Images
    • ScreenHunter_82 Jul. 16 09.52.jpg

      23.53 kB, 355×398, viewed 598 times
  • Hello Johanan,

    Thanks for the information. There is a mistake in the emWin user manual.
    The correct prototype is: void CALENDAR_SetDefaultBkColor(unsigned Index, GUI_COLOR Color);
    We will correct the emWin user manual.

    Unfortunately there was a problem to set the background color of a CALENDER widget in a earlier emWin version, but this is fixed in the current version.

    For you an example callback function to draw a rectangle around the calender:

    C Source Code

    1. static void _cbCalendar(WM_MESSAGE * pMsg) {
    2. WM_HWIN hWin;
    3. GUI_RECT Rect = {0};
    4. hWin = pMsg->hWin;
    5. switch(pMsg->MsgId) {
    6. case WM_PAINT:
    7. CALENDAR_Callback(pMsg);
    8. Rect.x1 = WM_GetWindowSizeX(hWin) - 1;
    9. Rect.y1 = WM_GetWindowSizeY(hWin) - 1;
    10. GUI_SetColor(GUI_BLACK);
    11. GUI_DrawRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
    12. break;
    13. default:
    14. CALENDAR_Callback(pMsg);
    15. break;
    16. }
    17. }
    Display All


    Best regards,
    Thorsten