swviewer-2.0.5.1008 and C#

Hello,

The XFORMS test file that I used could not be display in the .NET application that I worte.
I basically followed the steps on the web site. However, the same XFORMS displays without
any problems in your Sidewinder application. The below is part of the code in C#.

Thank you,

Pat

public partial class Form1 : Form
{
private RendererLib.IRender Renderer;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
this.Renderer = (IRender)new RendererLib.RendererClass();
this.Renderer.Initialise(null);

DispatchRendererEvent("renderer-set-parentwindow",
(int)this.Panel.Handle, 0);
DispatchRendererEvent("renderer-set-windowstyle", 2, 0);

DispatchRendererEvent("renderer-set-position", 0, 0);
DispatchRendererEvent("renderer-set-dimensions",
this.Panel.ClientRectangle.Width,
this.Panel.ClientRectangle.Height);
this.Renderer.InitialiseWindow();
}

private void DispatchRendererEvent(string sType, int nParam1, int nParam2)
{
IRendererEvent evt = (IRendererEvent)new RendererEventClass();
evt.initRendererEvent(sType, false, false, nParam1, nParam2, "");
IEventTarget tgt = (IEventTarget)this.Renderer;
tgt.dispatchEvent((DOMEvent)evt);
}

private void Button_Click(object sender, EventArgs e)
{
Uri uri;
String sFragId ;
sFragId = "";
uri = new Uri(@"C:\Documents and Settings\pm\Desktop\temp0001.xhtml");
String sURL = uri.AbsoluteUri;
String sBase = sURL.Substring(0, sURL.LastIndexOf('/') + 1);
this.Renderer.LoadURI(sURL);
this.Renderer.Render(sFragId, sBase);
}
}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Please try a newer version of Sidewinder

Hi Pat,

If you also post the form that you are using here, I should be able to run through it in the debugger and see exactly what the problem is. However, I notice that the version of Sidewinder you have installed is now slightly dated. Newer releases are available that contain significant improvements to the Renderer component and I recommend you try installing version 2.1.0.1007 to see if it fixes your problem.

Regards,
Phil.

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

still not working

Hi Phil,

I did as you suggested. But, it still does not work. The embeded control remains blank. I used xhtml document from http://www.w3.org/2000/07/8378/xhtml/media-types/test.xhtml .

Thank you very much,

Pat

Possibly a renderer bug

Hi Pat,

I think this problem may be caused by a bug in the renderer, where it fails to bind formsPlayer's XForms factory class to rendered documents if the 'restricted navigation' flag is not set. You can easily test this theory at your end by adding a single line of code to your source and re-testing:

 private void Form1_Load(object sender, EventArgs e)
{
    this.Renderer = (IRender)new RendererLib.RendererClass();
    this.Renderer.Initialise(null);

    DispatchRendererEvent("renderer-set-restrict", 0, 0);

    DispatchRendererEvent("renderer-set-parentwindow", (int)this.Panel.Handle, 0);
    DispatchRendererEvent("renderer-set-windowstyle", 2, 0);

    DispatchRendererEvent("renderer-set-position", 0, 0);
    DispatchRendererEvent("renderer-set-dimensions", this.Panel.ClientRectangle.Width, this.Panel.ClientRectangle.Height);

    this.Renderer.InitialiseWindow();
}

However, setting this flag also requires that your application listens for and handles navigation events, which is not something that I've documented yet. If you could try making the above change then letting me know whether it has any effect on your problem, I'd be very grateful. I shall then get on with resolving the bug and also documenting the navigation events (not to mention some other events which you may find useful).

Regards,
Phil.

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

using simple-host.cs

Hi Phil,

After sending you the above message, I downloaded your code simple-host.cs from http://svn.x-port.net/svn/public/samples/host-sidewinder/
,which has DispatchRendererEvent("renderer-set-restrict", 0, 0);. I still could not see anything.

Thank you,

Pat

Possible workaround available, bugs to be fixed soon

Hi Pat,

Okay, I have got to the bottom of this now, apologies for my earlier misdiagnosis. There were basically two renderer bugs causing your problem [1] [2], which I shall resolve shortly. In the meantime, a temporary workaround exists if you are able to remove the DOCTYPE element from your XHTML documents.

Regards,
Phil.

[1] Renderer wrongly returns success code if LoadXML or LoadURI fail
[2] Renderer is not setting new MSXML 6 properties

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

Examples

Hi Phil,

Could you please let me know how to post some xhtml examples for you to test?
Our examples do not have DOCTYPE element.

Thank you,

Pat

Please use my contact form

Hi Pat,

I was just using the example that you provided above. If you would like to post a different example to me directly, you can do so via my contact form.

Regards,
Phil.

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

Feedback on your forms

Hi Pat,

Thanks for the forms that you sent through to me, I've taken a look at that them and don't believe there are any further bugs other than those already mentioned earlier in this thread.

Your first form appears to be coded to an ancient version of the XForms recommendation - the defunct elements button and caption are now called trigger and label respectively, so I see no renderer bugs here. For reference purposes, I've included links to the latest version of the XForms recommendation [1], our Introduction to XForms tutorial [2] and our samples page [3] below.

The second form is malformed XML and thus falls foul of one of the bugs that I mentioned above. If you remove the quotation mark that appears after the document element closing tag, the renderer will process the document correctly. This kind of problem will be much easier to spot in the next version of the renderer, since it now returns rich error information if a document fails to parse.

I'll let you know when the new release is available.

Regards,
Phil.

[1] XForms 1.0
[2] Introduction to XForms
[3] formsPlayer Samples

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

Sidewinder Viewer vs Renhost.cs

Hi Phil,

I have fixed my XHTML file per your instuctions. The XHTML only renders in
Sidewinder Viewer. It does not render and produces exception in your sample
C# program, Renhost.cs. I got it from
http://svn.x-port.net/svn/public/samples/host-sidewinder/

I have never been able to render _any_ XFORMS document using the sample code
above. I have Windows XP with upto date service packs and Visual Studio 2005 with SP1.

The Renderer4.dll version is 3.3.1.1005, dated 7/19/2007 3:30pm.
The IE-HTML.xsl is also located in the [Program Files]\Common Files\Sidewinder\Renderer\
directory.

Thank you,

Pat

Exception is as follows :

System.Runtime.InteropServices.COMException
Empty document encountered in 'HTML4RendererWin32::Render'.

" at RendererLib.RendererClass.Render(String sFragmentIdentifier, String
sBaseURI)\r\n at XFORMS.RenHost.Button_Click(Object sender, EventArgs e)
in C:\\myprojects\\XFORMS\\XFORMS\\RenHost.cs:line 156\r\n
System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at
System.Windows.Forms.Button.OnClick (EventArgs e)\r\n at
..."

Please re-check the version number

Hi Pat,

Firstly, I need you to re-check the version number of Renderer4.dll for me. I would expect the version number of that DLL to be 4.n.n.nnnn, whereas the version you quote I would expect from Renderer.dll instead. If Renderer4.dll is truly at version 3.3.1.1005, then your installation is corrupt and this may be the source of your problem.

On a related note, you should also ensure that it is Renderer4.dll (rather than Renderer.dll) that was imported to your C# project. Although I would not expect your code to compile if this was wrong, it is worth double checking.

Lastly, I am going to send you an updated Renderer4.dll that will output extra debug information around the transformation that I suspect is failing. The log files that are generated should help me see exactly what the problem is.

Regards,
Phil.

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

A-OK

Hi Phil,

The dll you sent (ver. 4.0.0.0000) works well. I can now see xforms in your C# application.

Thank you,

Pat

Good news

Hi Pat,

That's good news. Let us know how you get on, or if you have any further questions.

Regards,
Phil.

--
Phil Booth, formsPlayer
www.formsPlayer.com
standards. innovation.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.