361 views
in GUI Development by
I want to change the frame rate of a bitmap in response to a slider.

I added the code to a an OnSliderChange Slot:

ChamFlow1 = ChamFlow1Slider.CurrentValue;

Resources::Top6060TriC3Sup.FrameDelay = 900 - (int32)ChamFlow1; // sets the frame rate of moving arrows

Error "Unknown definition"

Is it possible to refer to a Bitmap Resource Property in a Slot Method?
by
I learned that the correct way to reference the bitmap resource in a Slot is:

Application::Top6060Tri.FrameDelay = 900 - (int32)ChamFlow1; // sets the frame rate of moving arrows

But, then I get an error message "FrameDelay is READ ONLY."

So, I think that means I can not change the FrameDelay from within the application.

1 Answer

0 votes
by

Hello,

I suppose, you are refering to animated bitmaps, right? In such case the animation speed is determined at the design time by setting the attribute FrameDelay. This value can't change at the runtime - it is thus read only.

To achieve your desired effect, don't set the FrameDelay attribute. Instead use a timer object to trigger the animation. You can configure the timer to fire with a period, which can change at the runtime. Each time the timer fires just increment the property FrameNumber of the image view used to display the bitmap (assuming you are using the Image view). Once you reach the last frame just set FrameNumer to 0 again to get an endles animation.

Does it help you?

Best regards

Paul Banach

 

by
Thank you for the confirmation that FrameDelay can not be set at run time.  I understand your proposed solution with a timer incrementing FrameNumber property. And I think it will work for me. Thank you for the suggestion.

Andy Lintz

PP Systems
by

Hello Andy,

just a further idea: instead of the timer you can use the Change Int32 effect. Just connect the effect object with the property FrameNumber of the respective Image view. When the effect is started, it will 'animate' the property and so also trigger the animation of the bitmap. Unlike the approach with timer, you don't ned to write any 'glue' code between the effect object and the Image view. You can connect them directly together. 

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...