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 ().

    • Thank you for the solution.
      It was great.

      If so, a few questions:.
      1. How to change the location because it is inside the image and does not cause the full picture to be seen.
      2. Why is UserData used? While it could do without UserData, as an example attached.

      Thanks again.

      Hossein.
      Files
    • 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