Forum  Core :: SDK (Vi...  Bug Reports  HTMLBox Reloads HTML on Screen Changes
Previous Previous
 
Next Next
New Post 2/8/2011 8:04 AM
Unresolved
  dmcgrail
166 posts
5th Level Poster


HTMLBox Reloads HTML on Screen Changes 
Modified By dmcgrail  on 2/8/2011 12:11:32 PM)

The HTMLBox is constantly reloading the HTML when there are screen changes. Most notibly when expanding and collapsing splitters programmatically. But sometimes when the browser window is maximized or restored. Example application has been submitted to support at visualwebgui.com and support at gizmox.com.

An explanation of how to reproduce the problem is contained in the sample application. Basically a splitter with a left and right. An HTMLBox on the right with www.google.com as the html. Search for something on google so the page contents change. Now click a button to collapse the splitter in code. The HTML in the htmlbox is back at the www.google.com main page. Or in a nut shell, the HTML reloaded.

 
New Post 2/16/2011 2:07 PM
  palli
11838 posts
1st Level Poster




Re: HTMLBox Reloads HTML on Screen Changes 
Modified By palli  on 2/26/2011 4:51:21 PM)

Hi,

This is happening because the serverside doesn't know about the changes you made clientside only, and when any control of Visual WebGui is resized, it will be redrawn based on the last known state, which in this case is just the "Click here" link. You can actually see this very clearly if you activate the Visual WebGui debug window, as when you click the "Click here" link, no request is sent to the server via the Visual WebGui pipeline, so your Visual WebGui application is not aware of any changes to the control.

If you are using the HtmlBox for displaying dynamic contents like you are in this case, you will see this behaviour. If you for instance set the HtmlBox.Url to an application, that handles it's own serverside state it should be fully capable of redrawing itself correctly. Try for instance setting the Url to http://www.google.com and resize the form. Google is still shown in the HtmlBox.

If you need further explanation, or if you need suggestions on how you can work around this using stateless contents in the HtmlBox let us know, and we will try to explain further.

Palli

 

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 2/17/2011 5:28 AM
  dmcgrail
166 posts
5th Level Poster


Re: HTMLBox Reloads HTML on Screen Changes 

Palli,

Yes I will need further explanation of a work around or solution. Maybe ASPNET form box could help. Maybe someother way to prevent redraw of control. Something. I need something.

Reason being is that I did not completely spell out what we are doing, so I will now. Of course we are not using Google.com, that was an example. Our application records telephone calls and has a database of recordings and a player. There is no standard MediaPlayer for ASP.NET or VWG so we use an HTML box and wrote our own simple WAV audio player using HTML and Windows Media Player or FireBox MediaPlayer plug in.

The HTML can be seen below. The problem we are having is that the HTML box is in one panel of many split containers with various other features around it, (as seen in the sample application I sent). Everything is fine and works fine until the user invokes a feature of our app and a large screen change occurs (user clicks another feature and one of the panels is expanded or collapsed - as seen in the sample application) the html is then relaoded. Someone listening to a 10 minute recording, who invokes another feature of our player to show/hide a panel, all of a sudden the call starts over becaue the HTML reloaded.

You can imagine, as a user, this is unacceptable. We seriously need a work around.

Note, The HTML below is from a source file. Our player module reads in this source, dynamically changes variables marked with '$' and then puts the html into an htmlbox control.

Also note, I changed all the html tags from < > to [ ] so that the HTML will be placed into the forum without complications. You should get the idea.

Thnx,

Dan
 

<!--
[html]
[head]
[title]$TITLE$[/title]
[/head]
[body]
    [object id="mpAudio" width="100%" height="60"
        classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
        type="application/x-oleobject" align="middle"]
            [param name="URL" value="$WAVE_FILENAME$" /]
            [param name="AutoStart" value="True" /]
            [param name="SendPlayStateChangeEvents" value="false" /]
            [param name="SendOpenStateChangeEvents" value="false" /]
    [/object]
[/body]
[/html]
-->

 
New Post 2/26/2011 1:24 PM
  palli
11838 posts
1st Level Poster




Re: HTMLBox Reloads HTML on Screen Changes 

Hi Dan,

As I mentioned in my last post, your problem occurs because you regenerate the Html contents on every rerendering of the HtmlBox, which occurs for instance during resize. This means that you Html code is reconstructed, and therefore everything is started from step one.

If you are looking for a Media playing that doesn't restart on resize, you can use one of our Hosting controls, either ActiveXBox or ObjectBox, as they do keep server state during resize and should work fine in this case.

For the sample code below, create a form with two panels and then paste this code. I both include an ActiveXBox and then an inherited ObjectBox.

 

    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
 
        public class MyActiveXPlayer : ObjectBox
        {
            public MyActiveXPlayer()
            {
                this.ObjectClassId = "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"; ;
                this.ObjectType = "application/x-oleobject";
            }
        }
 
        private void Form2_Load(object sender, EventArgs e)
        {
            ActiveXBox ab = new ActiveXBox();
            ab.ClassId = "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";
            ab.Type = "application/x-oleobject";
            ab.Parameters["URL"] = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";
            ab.Dock = DockStyle.Fill;
            this.panel2.Controls.Add(ab);
 
            MyActiveXPlayer ob = new MyActiveXPlayer();
            ob.Parameters["URL"] = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";
            ob.Dock = DockStyle.Fill;
            this.panel3.Controls.Add(ob);
 
        }
    }

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 2/28/2011 1:31 PM
  dmcgrail
166 posts
5th Level Poster


Re: HTMLBox Reloads HTML on Screen Changes 
Modified By dmcgrail  on 3/1/2011 8:53:55 AM)

Palli,

We are getting closer but not quite there. In an HTMLBox I can use all kinds of cool java scripts to do various things. Using an ActiveX box or an object box I seem to be limited to defining a Class Object and respective parameters. It seems I have no way of accessing the objects events and other properties.

For instance. See the HTML below. I have an event wired into the Class Object that will "SendOpenStateChangeEvents". Notice in JavaScript I have said function and will get an event from MediaPlayer. Also notice in JavaScript I can access the duration of media by getting that param "document.mediaPlayer.CurrentMedia.Duration".

Using your sample code, I tried accessing the variable "document.mediaPlayer.CurrentMedia.Duration" via ab.GetParameter(document.mediaPlayer.CurrentMedia.Duration") but I have no luck. Also using your example, I tried wiring up the event via ab.Parameters["SendOpenStateChangeEvents"] = "True" but where would the event fire?

Using your example, how do I access the object model and its properties, methods and events?

Seems we have issues with HTMLBox and Hosting Controls.

Whats next?

Also, in your first reply, you said "If you need further explanation, or if you need suggestions on how you can work around this using stateless contents in the HtmlBox let us know, and we will try to explain further.".

I guess we are at the point where I need to know how I can use "Stateless Contents" in the html box. This will give me the best of both worlds. A complete HTML file where I can set the object tag and its properties and wire up events, and javascript where I can access the complete object model with its respective properties, methods and events. Please reply. Thnx.

Last but not least, considering this is all part of one issue for us, please look at post: http://www.visualwebgui.com/Developers/Forums/tabid/364/forumid/59/threadid/46969/scope/posts/Default.aspx as we will need to know how to reach down and grab a javascript variable as well. One sample C# project showing all of this would be ideal and greatly appreciated.

 


<!--

<HTML>
<HEAD>
<TITLE>TEST</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE = "JavaScript">

var PlayerReady = 0;
var IsNewLoad = 0;
var timerId;

function MediaPlayer_Load() {
    if (document.mediaPlayer.ReadyState < 4)
    {
        timerId = setTimeout("MediaPlayer_Load()",250);
        return;
    }
   
    if (!PlayerReady)
    { 
       document.mediaPlayer.Controls.stop();
       PlayerReady = 1;
    }
   
    if (PlayerReady)
    {
       clearTimeout(timerId);
       IsNewLoad = 1;
       setInterval("DSP_rotate()", 1000);
    }         
}
function MediaPlayer_Play() {
    document.mediaPlayer.Controls.play();

}
function MediaPlayer_Stop() {
    document.mediaPlayer.Controls.stop();
}
function DSP_rotate() {
   if (IsNewLoad == 1) {
       IsNewLoad = 0;
       MediaPlayer_Play();
   }
   else  {
       document.playerCtrl.Length.value=document.mediaPlayer.CurrentMedia.Duration;
       document.playerCtrl.Position.value=document.mediaPlayer.Controls.CurrentPosition;
   }
}

</SCRIPT>
</HEAD>
<BODY>
<center>
<FORM NAME="playerCtrl">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top><P><FONT face=Verdana size=2>File Length:</FONT></P></TD>
    <TD vAlign=top><P><INPUT value="Loading . . ." name="Length" READONLY><FONT face=Verdana size=2></FONT></P></TD>
    <TD vAlign=top><P><FONT face=Verdana size=2>Current Position:</FONT></P></TD>
    <TD vAlign=top><P><INPUT value="Loading . . ." name="Position" READONLY><FONT face=Verdana size=2></FONT></P></TD>
  </TR>
  </TBODY>
</TABLE>

<BR>
<BR>
<P>
<object id="mediaPlayer" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" align="middle">
  <PARAM NAME="URL" VALUE="$$YOUR_VIDEO$$">
  <param name="AutoStart" value="False" />
  <param name="ShowStatusBar" value="True" />
  <param name="StretchToFit" value="False" />
  <param name="uiMode" value="full" />
  <param name="SendOpenStateChangeEvents" value="True" />
</object>
</P>
</FORM>
</center>

<SCRIPT LANGUAGE = "JavaScript">   
        MediaPlayer_Load();
</SCRIPT>
<SCRIPT FOR="mediaPlayer"
        EVENT="OpenStateChange(lOldState, lNewState)"
        LANGUAGE="JScript">
        if (lNewState >= 6) {
            if (!PlayerReady) {
                PlayerReady = 1;
                setInterval("DSP_rotate()", 1000);
            }
        }
</SCRIPT>
</BODY>
</HTML>

-->

 
Previous Previous
 
Next Next
  Forum  Core :: SDK (Vi...  Bug Reports  HTMLBox Reloads HTML on Screen Changes
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS