Forum  Core :: SDK (Vi...  Control Enhance...  Need ability to add javascript to client easily
Previous Previous
 
Next Next
New Post 12/18/2009 7:37 AM
  msawczyn
190 posts
5th Level Poster


Need ability to add javascript to client easily 

We currently have the InvokeMethod call that can be made server-side to call javascript on the client. But there's no good (read: easy) way to add custom javascript that can be called via InvokeMethod. We're limited to either calling intrinsic methods that exist on the browser or calling methods that exist in VWG stock controls or in custom controls that we write.

Writing a custom control is a lot of work (even extending an existing one) just to emit a bit of javascript.

I'm proposing the addition of another method to the Form class that would allow javascript to be sent to the client, therefore giving us the opportunity to later call InvokeMethod on that javascript. Something similar to RegisterClientScriptBlock. The script could be emitted into the HEAD, thereby callable server-side.

Thanks.

-- Michael

 

 
New Post 12/24/2009 7:23 AM
  ori.cohen
4390 posts
1st Level Poster




Re: Need ability to add javascript to client easily 

Hello Michael,

I would like to better understand your needs here, so it may be very helpful if you could please describe to me what it is that you are trying to accomplish in the UI flow, and what is the scenario you are constructing in your application. It would greatly help me to see the bigger picture. I would be able to either open an issue for required changes in our framework, or suggest to you the best implementation available to achieve what you want in your VWG application.

There is a scoping engine for JavaScript used in Visual WebGui and I want to make sure what I suggest for you to use or for us to implement will benefit both you and us as much as possible.

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
New Post 12/24/2009 9:56 AM
  msawczyn
190 posts
5th Level Poster


Re: Need ability to add javascript to client easily 

Hi Ori,

It all started in this post, where I was looking to be able to resize the initial browser size ... more in line with the way WinForms works, where the size that we set the window at design time is the size that the window first appears. I can call a javascript function to do this, but I need to get that function (and its helper functions) into the browser's environment space first.

That's where I got stuck. It seemed that I could derive from Form and output my own javascript, but that was a really heavy approach for something that seemed, on the surface, to be an action that should be easy. And in my experience, if I have to work hard against a framework to do something that should be easy, it's almost always my lack of understanding of the framework. So I asked the question, and from what I got from Palli it seems that I was right -- there is no easy way to add javascript to the output.

Thanks for any help you can provide.

-- Michael

 

 

 
New Post 12/29/2009 3:34 AM
  ori.cohen
4390 posts
1st Level Poster




Re: Need ability to add javascript to client easily 

Hello Michael,

Please consider placing your Form content in a UserControl instead, giving this control the size you want the application to have.
Then you could place the UserControl either on the MainForm or in a modal dialog Form.
If you place the UserControl on the MainForm, no matter what the size of the window will be the UserControl will stick to the left top corner and will not strech (unless you want it to).

If you place it on a dialog, you could use it as a light-box with all the application content inside and the part outside the dialog Form will be completely opaque. If you want to customize the Form, it will allow you to remove the title-bar, so the minimize, maximize and close buttons will not show and dragging it around will not be possible.

Creative solutions will have to be found, because web-application window resizing is not only unconventional, but unfeasible, if you want multi-browser support.

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
New Post 1/5/2010 2:26 AM
  msawczyn
190 posts
5th Level Poster


Re: Need ability to add javascript to client easily 

Hi Ori,

I have written applications where the content is in a Panel which is not anchored to any side, thereby allowing the panel to float in the center of the browser, but that's not the effect I'm after. I don't have an issue with the user resizing the browser, and the content will, of course, behave appropriately when they do (just like a WinForm application), but I am wanting the browser window to start its life at a certain size (just like a WinForm application).

That being said, there's really two things going on here:

1) I believe I have the javascript for multi-browser support. I'm not concerned about that, but that's really the smaller picture.

2) The bigger picture is, as far as I've been able to find, there's really no good (read: easy) way to add custom javascript to a VWG form. In general, I believe that's a problem that needs solved. Solutions could be an api call that injects the javascript in an appropriate place, a control that can get added to the form to output javascript, or something I haven't thought of, but IMHO that facility needs to be there.

I can see the issue where the javascript emitted by the programmer might conflict with that emitted by the VWG engine, but that would be on the programmer's shoulders to fix. A few simple caveats in the documentation may be enough to help the programmer determine would can and should not be done in custom javascript. But that's, I believe, an issue today with custom controls anyway.

-- Michael

 

 
Previous Previous
 
Next Next
  Forum  Core :: SDK (Vi...  Control Enhance...  Need ability to add javascript to client easily
CompanionKit Bottom
.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