Announcement

Collapse
No announcement yet.

Enable/disable smart slider layers in run time

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Enable/disable smart slider layers in run time

    Hello, I would like to know if it is possible to have a smart slider object with multiple progress bars layers, and to enable/disable them through 4dgl code. For example, when the module turns on, the progress bar of the smart slider would be blue. After some user action, I would like the progress bar of the smart slider to turn green. Is it possible?

  • #2
    Hello,

    Welcome to the forum!

    You can try manipulating the smart objects editor in such a way that it changes color at a certain frame. e.g. frame 0-50 is green then frame 51-100 is blue.

    Since you have access to Smart Widgets, I assume you have acces to magic object as well.

    This would allow you to call a specific frame at a specific time.

    I've attached a sample project to further demonstrate my suggestion.

    I hope this helps
    Attached Files
    Michael

    Comment


    • #3
      Hello Michael,

      Unfortunately, the solution you proposed does not help me. In my application, I would need the color of the slider bar to change after a button click. The actual frame of the slider should not change due to this click, only the color shown. I was wondering if there is some variable regarding the layers of the smart slider object that could be used to achieve this behavior.

      Comment


      • #4
        Hello,

        You cannot enable/disable the layers manually during runtime.

        Since you have control over which frame will show up at any given time, I don't understand why my suggestion wouldn't work.

        In the sample program that I sent, the frames for the initial progress bar (0-29) are quite proportional to the second progress bar (65-100).

        The frames are not exactly the same amount but you can adjust this by either editing the layer 1 image or adjusting the frames through the smart widgets editor.

        After that, you can just add a few frames to the "real frame" every time a touch is detected. Something like
        Code:
        if (touch_Get(TOUCH_STATUS) == TOUCH_PRESSED || touch_Get(TOUCH_STATUS) == TOUCH_MOVING)
              frame := frame+65     // where 65 is the number of offset frames
        endif
        If my initial suggestion doesn't fit your application, you could try making two sliders with different colors and place one over the other. You'll then need to hide the initial slider and show the other one every time you need to switch between the two.

        I hope that was clear enough.

        Best regards,
        Michael

        Comment

        Working...
        X