Wednesday, March 21, 2012 1:07 AM
I have a problem with styles that I really do not understand. The goal is to emulate the the jquery animate function. What I am doing is displaying a HTML window via an C++ animate implimentation. The problem is that the function works well and displays the proper CSS values, but if you look at the actual html it is not rendered properly. Here is the order of events in my code.
1. Create a style sheet with the parameter for the margin set to the following. (atually the actual style sheet is a resource in the DLL)
margin: -108px -50px 0 0;
2. delay a couple hundred milliseconds until the style sheet is active
3. Call the animate function to change the margin over 200 ms to a margin right of -498px and margin top to 2px.
4. With that setting the window is supposed to be visible but is not.
Now when you look at the Developers studio and the style for that particular setting it shows that everything worked properly and the margin had the proper set point after animation. Although visibly it is not correct (but developers studio displays the proper settings). So if I change the setting of the top or right margin by a pixel and in the developers studio...hit enter ...and bang the window appears. So something is telling me that my setAttribute function is not triggering something
I even tried to bypass the animation and directly set the style via setAttribute and it still does not work. However developers studio does show the proper values.
It seems that programmatically setting the margin does not work or does not trigger IE to adjust to the new setting.
My theory is that somehow the initial style sheet that I created is somehow overriding the programmatic settings.
Does anybody know what is going on? It seems like there has to be away to get the document to act on my new css settings?
Any suggestions would be greatly appreciated.
Thursday, March 22, 2012 6:03 AMYour IE version is ?
Thursday, March 22, 2012 1:48 PMIE 8.0 is currently on my development system. But this has to work for IE 7.0 and above and on XP Pro, Vista and WIndows 7.0.
Monday, April 02, 2012 10:16 PM
I tried to use the runtime style interface and that did not work either.
This is a bizarre issue.
What is the difference between entering a value using the developers studio and using the IHTMLStyle interface to change the margin? Is this something to do with the content being editable?
Monday, April 02, 2012 11:37 PM
Okay after a couple weeks with on an off troubleshooting I figured out what the issue is.
My style sheet was initially setting the margin at "-108px -50px 0 0;". Which was working fine. So no problems so far!
But when I created my animate function I was incrementing the values of marginTop and marginRight in my code which appeared to work. Even though the developers studio indicated the values were set - they were not!!! So the developers studio was giving me a false positive. AT least that is what I believe. (This led me down many incorrect paths I might add)
What I had to do is set all margine properties simultaneously like the following
spStyle->put_margin(CComBSTR("2px -469px 0px 0px"));
Once I did that I was able to get the animate function to work without issue.
Can anybody explain this to me? Is it the fact that I set all of the margin parameters in the CSS file? Any guesses? Someone got an idea? What is the rule of thumb?