Unable to use custom WHEEL_SetOwnerDraw function

    • Unable to use custom WHEEL_SetOwnerDraw function

      Hi,
      I am trying to create a custom draw function for the WHEEL widget.
      From the documentation, here segger.com/doc/UM03001_emWin.html#User_drawn_widgets
      I have to handle 5 cases in my custom draw function i.e. WIDGET_ITEM_GET_XSIZE, WIDGET_ITEM_GET_YSIZE, WIDGET_ITEM_DRAW, WIDGET_DRAW_BACKGROUND and WIDGET_DRAW_OVERLAY.

      I have handled the cases relevant to my use case, but I am getting random values in pDrawInfo->Cmd. Very large integers such as 333837784. Please refer to the screenshot.

      Why is it not working as expected?
      I am trying to add alpha blending to the top and bottom of each of my wheel and I need custom draw function for that.

      Please help, thanks!
      Images
      • Screenshot 2025-04-22 181003.png

        164.02 kB, 1,190×709, viewed 42 times
    • Hello,

      the commands you listed probably relate to LISTWHEEL legacy widget not to WHEEL widget. The commands for WHEEL widget are not documented at all, and yes, they have undocumented values. Apparently default draw function WHEEL_OwnerDraw...() is not clearly described so you can't see how it does things without emWin sources. The only thing you can do is doing some tricks within WM_PAINT message or may be using WHEEL_SetOverlay()
      Regards,

      Anthony
    • Hi Sarthak,

      I agree with Anthony here. For what you are trying to do, the routine WHEEL_SetOverlay() is the best fit.

      The WHEEL_OwnerDraw() does not currently support commands at all, the routine simply draws everything in one go. So this interface can only really be used to swap out entire drawing routines, not individual components.

      Best regards,
      Florian
      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.