Using Window Manager

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

  • Using Window Manager

    Hi all,

    I have been using emWin on the STM32 for a couple of weeks now, using the GUI Builder and Window Manager I have a screen with text that I can change from user code, respond to touch inputs etc.

    My question is really a general one about recommended practice using Window Manager, am I right in saying that in order to put extra text / draw on a window when using Window Manager it is then your responsibility to re-draw it? I could only get something to be drawn to the window under WM_PAINT, so I assume in each window you just put everything you may need... then show / hide and change properties of the widgets accordingly.

    I'm also slightly confused about the callbacks, could someone provide an explanation or situation where they are used? This style of programming is fairly new to me and the documentation isn't helping me a great deal.

    Many Thanks

    Anthony
  • Hello Anthony,

    The Window Manager works based on events. Once an event happens, the Window Manager sends according messages to the affected windows. Please note that widgets actually are windows with enhanced functionality, so in every case the same actions can be performed with both widgets and windows. The Window Manager checks if events happened every time it is executed, so it is required to use an infinite loop in which the Window Manager is executed. The Window Manager can be exectued using the functions GUI_Delay(), GUI_Exec() and WM_Exec(). Those functions call each other in the mentioned order.

    Windows can be valid or invalid. Invalid windows need to be redrawn, valid do not. Once the Window Manager detects windows being invalid at least one WM_PAINT message is sent to the window. The callback function is used to process messages. There is an internal callback function, but a custom callback function can be set. So if you want something to be drawn on a window, you should use a custom callback function in order to react to the WM_PAINT message.

    For detailed information, please refer to the section 16.2 "The Window Manager" -> "Callback mechanism, invalidation, rendering and keyboard input" in the emWin user manual.

    Best regards,
    Adrian