Animation index issues

S

Simon H

I am trying to dynamically display results from external data sources and
wish to resize objects such as rectangles on the fly, whilst the presentation
is running. This works fine, but when I add animated objects to the slide and
display the data (thus resizing the shapes) , powerpoint resets the animation
click count back to 0, and the animations go back to the beginning, so I get
stuck in an infinite loop can't leave the slide.

I have found that changing an msoShape width, height or position resets the
click count, but not if I change any text associated with the shape (or in a
text box).

I have also saved the click count (lastCount = GetClickCount()) before
moving and called GoToClick(lastCount) after moving but this doesn't seem to
make any difference- it still starts back at the beginning. I am also sure I
am working in the correct view & slide.

Does calling GoToClick() cause SlideShowOnNext to be called again or does it
just force the show to the next animation?

Any ideas? - I'm stumped.
 
J

John Wilson

I'm a little confused by your code but AFAIK GetClickCount returns the total
number of clicks to complete the slide animations

GetClickIndex may be what you need?
 
S

Simon H

Thanks for the quick reply, I should have written GetClickIndex(), my
apologies.

You should be able to replicate the problem by trying this :

Create a presentation with a couple of slides, then on the second slide add
a couple of pictures or shapes, animate each one in any way you choose. Add
another shape without animation and then create an add-in with an event
handler on SlideShowOnNext, and put the following code in:

if (MessageBox.Show("move the picture ", "Test",
MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
{
int idx = Wn.View.GetClickIndex();
foreach (PowerPoint.Shape s2 in sl.Shapes)
if (s2.Name.Equals(put your Shape Name
here))
s2.Width += 20;
Wn.View.GotoClick(idx);
}
MessageBox.Show("click count = " +
Wn.View.GetClickIndex());

where "your shape name" is the name of the unanimated shape.

You will notice that if you answer yes (and make the shape wider) it affects
the animation sequence, answer "no" and everything will work.
(the above code has been cut & pasted from my app)
 
S

Simon H

Ah, that's what I suspected, but rather hoped was not the case.

Would I be correct in assuming the beast doesn't like being speared with a
different animation index, and that in this case GoToClick() may not
penetrate it's scales ?
 
A

Austin

You can create a new sequence but that two comes with a boat load of
limitations, primarily its going to cause the slide to reset. The other
nasty that is sure to raise its head is removing focus from the slide show
window. (You are changing the presentaiton, not the slide show so focus
jumps back to PPT.
 
S

Simon H

Thanks for the info. Is there any way to suspend the animation through code,
then re-enable it once I have updated the shapes position/size, hence
avoiding the reset ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top