create scrollbar for image

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

    • Hello,

      for scrolling a bitmap I'd create that bitmap as an IMAGE widget, not just drawing it with GUI_DrawBitmap().
      Then you can attach scrollbar to the IMAGE widget and set custom callback function to the widget for scrollbar handling.
      Try the code attached. There is a WINDOW widget with a child IMAGE widget and vertical scrollbar attached.
      And you need to recalculate scrolling coefficient according to your image and scrollbar configuration.

      Alex.
      Files

      The post was edited 2 times, last by LexaGb ().

    • Hello,

      Yes, you can do without userdata getting a scrollbar value in WM_PAINT.
      In the previous example the scrollbar attached to the image as a child widget therefore its location is inside the image and takes up the image space.
      In order to avoid covering the image you can either increase XSize of the image by the scrollbar size or create the scrollbar as a sibling widget to the image not as a child also in GUIBuilder. I simply changed the code to do accordingly.

      Alex.
      Files