|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 83
|
Hi,
I'm trying to set ContentURL, left and top positions of a dialog using only java script. The dialog do show, but none of my setting seems to have effect. This is the first time I'm handling this object using only script. It is very possible that I'm not using the right properties.
I'd be appreciate for some help.
function ShowChangeUW(app, sfx, itemleft, itemtop) { itemleft = Number(itemleft) + window.screenLeft + 10; itemtop = Number(itemtop) + window.screenTop + 20;
var path = '../controls/changeuw.aspx?a=' + app + '&s=' + sfx; var myDialog = eo_GetObject('dlgContentURL'); myDialog.ContentUrl = path; myDialog.OffsetX = itemleft; myDialog.OffsetY = itemtop; myDialog.show(true); }
Thanks
Steve Komaromi
Computer Systems Manager, Lead Developer Business Risk Partners, Inc. Tel: 1-(860)-903-0039
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, You won't be able to do it this way because the dialog object (myDialog in your code) is a JavaScript object, it is NOT a DOM object. All methods available on the dialog objects are here: https://www.essentialobjects.com/doc/jsdoc.public.web.dialog.aspxYou would use move method to move it: https://www.essentialobjects.com/doc/jsdoc.public.web.dialog.move.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 83
|
Hi,
I'm not sure what you mean that in my code "myDialog" is a JavaScript object. I though executing eo_GetObject('dlgContentURL'); will get handle over an existing object on the page. I just try to manipulate that object through javascript.
<eo:Dialog id="dlgContentURL" runat="server" Height="100px" Width="320px" BackColor="#47729F" HorizontalAlign="Left" HeaderHtml="Message" ControlSkinID="None" BackShadeColor="Silver" AcceptButton="btnContentURLClose" CloseButtonUrl="00070101" MinimizeButtonUrl="00070102" RestoreButtonUrl="00070103" BackShadeOpacity="75" Font-Names="Courier New" VerticalAlign="Middle"> <closeeffect type="Pixelate" /> <showeffect type="Pixelate" /> <headerstyleactive csstext="border-right: #22456a 1px solid; padding-right: 4px; border-top: #ffbf00 3px solid; padding-left: 4px; font-weight: bold; font-size: 11px; padding-bottom: 2px; color: white; padding-top: 2px; border-bottom: #22456a 1px solid; font-family: verdana; text-align: center" /> <contentstyleactive csstext="background-color:white;border-bottom-color:#22456a;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#728eb8;border-left-width:1px;border-right-color:#22456a;border-right-style:solid;border-right-width:1px;border-top-color:#7d97b6;border-top-style:solid;border-top-width:1px;color:white;font-family:'courier new', verdana;font-size:11px;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" /> <contenttemplate /> <footerstyleactive csstext="border-right: #22456a 1px solid; padding-right: 4px; border-top: #7d97b6 1px solid; padding-left: 4px; border-left-width: 1px; font-size: 11px; border-left-color: #728eb8; padding-bottom: 4px; color: white; padding-top: 4px; border-bottom: #22456a 1px solid; font-family: verdana" /> <headerstyleinactive csstext="text-align: center" /> <footertemplate> <div style="text-align: center"> <asp:Button ID="btnContentURLClose" runat="server" Width="115px" CssClass="Btn_Light" Text="Close" CausesValidation="false" /> </footertemplate> </eo:Dialog>
Thanks
Steve Komaromi
Computer Systems Manager, Lead Developer Business Risk Partners, Inc. Tel: 1-(860)-903-0039
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
For each control, there are at least three separate but related objects. It's important for you to understand the difference between them so that you can use them properly. In case of the dialog, there are:
1. The server side EO.Web.Dialog object. This is a .NET object that only exists on the server side (because .NET code only runs on your web server). This object is responsible to generates some HTML and JavaScript code that will be sent to the client side (browser). The browser then parses and run those code to create client side objects. This is the object you use in your server side code;
2. The client side DOM objects. These objects directly corresponds to an HTML element (that was generated by the server side EO.Web.Dialog object). For example, a dialog could be a simple DIV element. Or it can be a group of HTML elements, such as DIV, table, or iframe (to host ContentUrl), etc. You usually do not have to work these objects directly;
3. The client side JavaScript Dialog object. This is myDialog in your code and it is created by the JavaScript code generated by the server side EO.Web.Dialog object. This is the object that you usually use on the client side. This objects provides helper functions so that you don't have to work with DOM objects directly;
Internally these objects work together. For example, when you set OffsetX on object #1, it will cause this value to be passed down to object #3, which in turn cause certain properties on DOM objects (#2) to be different when the dialog is displayed. But they are still different entities so you can't treat them as one.
In your code, you are trying to set myDialog.OffsetX. This won't work because myDialog is object #3 and OffsetX is a property on object #1. So if you are using object #3, you can only use whatever available on object #3.
Hope this makes sense to you.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 83
|
function ShowChangeUW(app, sfx, itemleft, itemtop) { itemleft = Number(itemleft) + window.screenLeft + 10; itemtop = Number(itemtop) + window.screenTop + 20;
var myDialog = eo_GetObject("dlgContentURL"); var path = '../controls/changeuw.aspx?a=' + app + '&s=' + sfx;
myDialog.setContentUrl(path); myDialog.move(itemleft, itemtop); myDialog.show(); }
Debugging the code eo_GetObject("dlgContentURL") does seem to return a client side object. Also it will pop-up the dialog consistent with the dialog declared in the html by with and height as well as transparency. However, the code segment (marked with bold) still have no effect.
Thanks
Steve Komaromi
Computer Systems Manager, Lead Developer Business Risk Partners, Inc. Tel: 1-(860)-903-0039
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 83
|
OK. So I figured it out that in order to be able to set URL property with java, the html object ContentUrl has to exist (initialized with bogus value). What property values need to be pre-set in order to the myDialog.move(itemleft, itemtop); to work?
Thanks
Steve Komaromi
Computer Systems Manager, Lead Developer Business Risk Partners, Inc. Tel: 1-(860)-903-0039
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
You need to call move after show and it only works if the dialog has no animation (otherwise you will need to wait for the animation to finish). Also you should not use window.screenLeft/window.screenTop. The dialog's coordination is always relative to the browser window because you can not display a dialog outside of the browser window.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 6/14/2007 Posts: 83
|
Thank you so much
Thanks
Steve Komaromi
Computer Systems Manager, Lead Developer Business Risk Partners, Inc. Tel: 1-(860)-903-0039
|
|