Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
natebell  
#1 Posted : Friday, July 6, 2007 12:18:32 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

I'm having trouble getting started with the AJAX. I'm reading both the Aurigma documentation and the MS AJAX documentation, but I am not sure how to access my instance of PhotoEditor.

I can see the Sys object and it's children, I can also see an object called PhotoEditor, and this has a child object called PhotoEditorController, but these seem to be types, not instances. I need to add a change method (add_changed) to the controller, but can't get to the actual instance of the object.

If someone can point me in the right direction that would be great.

thanks,
Nate
Sergey Peshekhonov  
#2 Posted : Friday, July 6, 2007 1:44:52 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

Hello, Nate.

You can access your instance of PhotoEditor using the following code.
You should add it to PhotoEditorSample.ascx. We use add_load because we need to know that PhotoEditor was fully initialized.

Code:
<script type="text/javascript">
    Sys.Application.add_load(function() {
        var photoEditor = $find(<% = "\"" + PhotoEditorController1.ClientID + "\"" %>);
        ...
        ... do something with photoEditor instance ...
        ...
    });
</script>


You can also add similar code to your page (Default.aspx):

Code:
<script type="text/javascript">
    Sys.Application.add_load(function() {
        var photoEditor = $find(<% = "\"" + PhotoEditorSample1.PhotoEditorController.ClientID + "\"" %>);
        ...
        ... do something with photoEditor instance ...
        ...
    });
</script>


In this case you should add property named PhotoEditorController in PhotoEditorSample.ascx.cs:

Code:
public Aurigma.PhotoEditor.PhotoEditorController PhotoEditorController
{
    get
    {
        return PhotoEditorController1;
    }
}

Edited by user Monday, December 17, 2007 7:40:09 PM(UTC)  | Reason: Not specified

Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
natebell  
#3 Posted : Monday, July 9, 2007 12:22:47 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

great, thanks for the tip
natebell  
#4 Posted : Monday, July 9, 2007 5:29:00 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

I'm having trouble with the StatusPanel. How do I make it show up and disappear when an action starts and stops? The PhotoEditor seems to do it automatically, but I want to reuse it for some custom buttons that may take time to execute. What javascript would I use, is there something I can look at?
Sergey Peshekhonov  
#5 Posted : Monday, July 9, 2007 6:14:38 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

Hello, Nate!

There is no property for setting status in the StatusPanel, because StatusPanel was developed just for PhotoEditor.
We think about adding this functionality to StatusPanel, so it may appear in the future releases.


But now, if you want use one StatusPanel both in PhotoEditor and into your code, you may use the following
workaround. Just past this code to the end of PhotoEditorSample.ascx file.

Code:

<input type="button" id="runButton" value="Run" onclick="click_on()"/>
<input type="button" id="stopButton" value="Stop" onclick="click_off()"/>
	
<script type="text/javascript">
	
function click_on() {
    var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);
    statusPanel.set_busyState($get("runButton"), true);
    return false;
}
	
function click_off() {
    var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);
    statusPanel.set_busyState($get("runButton"), false);
    return false;
}
	
Sys.Application.add_load(function(e, t) {
	
    if (t.get_isPartialLoad()) return;
		
    var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);

    statusPanel.objects = new Array();
	
    statusPanel._onStatusChanged = function() {
        var bv = $find(this._bitmapViewerId);
        statusPanel.set_busyState(bv, bv.get_status() == GraphicsMill.UpdateStatus.busy);
    }
	
    statusPanel.set_busyState = function(obj, state) {
        var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);
			
	// Add a little method for setting status css class.
        statusPanel._setState = function(state) {
            this.get_element().className = state ? "StatusPanelBusy" : "StatusPanel";
        }
			
        // Add array.
        if (!statusPanel.objects) {
            statusPanel.objects = new Array();
        }
			
        if (state) {
            for (var i = 0; i < statusPanel.objects.length; i++) {
                if (statusPanel.objects[i] == obj) {
                    return;
                }
            }
            Array.add(statusPanel.objects, obj);
            statusPanel._setState(true);
        }
        else {
            Array.remove(statusPanel.objects, obj);
            statusPanel._setState(statusPanel.objects.length != 0);
        }
    }
});
</script>


If you have some questions about this code please feel free to contact us.

Edited by user Monday, December 17, 2007 7:40:55 PM(UTC)  | Reason: Not specified

Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
natebell  
#6 Posted : Tuesday, July 10, 2007 12:09:39 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

Thanks Sergey,

I'll try to apply this code to mine and let you know how it goes!

Nate
natebell  
#7 Posted : Monday, July 16, 2007 3:54:13 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

Sergey,

I was able to come up with my own "status" for my buttons. However, on the photoeditor statuspanel, I can't seem to get text to appear there so I can tell the user what is happening. All it has is the rotating image.

How do I add text to the "busy" state of the StatusPanel?

Thanks,
Nate

Edit: this post could probably be it's own topic
Sergey Peshekhonov  
#8 Posted : Tuesday, July 17, 2007 5:34:55 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

If you just want to add text to StatusPanel you may do the following:

1. Let's take code from my previous post and replace the following:

Code:

<input id="runButton" type="button" onclick="click_on()" value="Busy" />
<input id="stopButton" type="button" onclick="click_off()" value="Free" />
	
<script type="text/javascript">

function click_on() {
    var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);
    statusPanel.set_busyState($get("runButton"), true);
    var el = statusPanel.get_element();
    if (el.childNodes.length)
        el.removeChild(el.childNodes[0]);
    el.appendChild(document.createTextNode("Busy"));
    return false;
}
		
function click_off() {
    var statusPanel = $find(<% = "\"" + StatusPanel1.ClientID + "\"" %>);
    statusPanel.set_busyState($get("runButton"), false);
    var el = statusPanel.get_element();
    if (el.childNodes.length)
        el.removeChild(el.childNodes[0]);
    return false;
}
...


2. Replace CSS classes (this example works for "Standard" theme):

In PhotoEditorSample.css.
Code:

.PhotoEditorSampleStatusPanel
{
	position: absolute;
	top: 4px;
	right: 10px;
}


In PhotoEditor.css
Code:

.StatusPanel
{
    width: 70px;
    height: 16px;
}

.StatusPanelBusy
{
    color: #FFFFFF;
    font-family: Arial, Tahoma, Geneva, sans-serif;
    font-weight:700;
    font-size: 9pt;
    width: 70px;
    height: 16px;
    background-image: url(../Images/StatusPanel/Progress.gif);
    background-position: right;
    background-repeat: no-repeat;
}


If you need for some additional functionality you may, for example, override the whole StatusPanel (server-side and client-side code) implementation.

Edited by user Monday, December 17, 2007 7:41:17 PM(UTC)  | Reason: Not specified

Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
natebell  
#9 Posted : Wednesday, July 18, 2007 5:30:06 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

so I could instead, use my own busy message and just use the js add_change remove_change?

i'll give that a try and see if I can do that, I'm understanding the ajax more now
natebell  
#10 Posted : Wednesday, July 18, 2007 6:17:31 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

i'm able to add the add_change to get it started, but it never goes away, when I use mine i call BeginBusyState() when i click my buttons, then in add_load of app I'm calling EndBusyState() and it gets rid of it... but after adding BeginBusyState to the add_change of the controller, I'm not sure how to remove it when the call is done
natebell  
#11 Posted : Thursday, July 19, 2007 5:40:29 AM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

I've used all of the Ms.Ajax events that I can think of and ALL of them so far haven't given me access to cancel the busy screen when I press a PhotoEditor button. They all work on my ajax buttons, but when I press the photoeditor buttons and the busy state begins, it never calls any of the functions i've tried to use to stop it

tried so far:
Code:

	Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(){
	//	EndBusyState();
		alert("begin request");
	});
	Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(){
	//	EndBusyState();
		alert("end request");
	});
	Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(function(){
	//	EndBusyState();
		alert("page loading");
	});
	Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function(){
	//	EndBusyState();
		alert("page loaded");
	});

Edited by user Monday, December 17, 2007 7:41:46 PM(UTC)  | Reason: Not specified

Sergey Peshekhonov  
#12 Posted : Thursday, July 19, 2007 7:53:04 PM(UTC)
Sergey Peshekhonov

Rank: Advanced Member

Groups: Member
Joined: 6/5/2007(UTC)
Posts: 57

Nate,

You should use statusChanged event of BitmapViewer to get know whether an image was changed in PhotoEditor.
I hope the following example will help you in this task.

Just add this code to the end of PhotoEditorSample.ascx:
Code:

<script>
Sys.Application.add_load(function(e, t) {
		
	if (t.get_isPartialLoad()) return;
			
	var pe = $find(<% = "\"" + PhotoEditorController1.ClientID + "\"" %>);
	var bv = $find(pe.get_bitmapViewerId());
	bv.add_statusChanged(function() {
		if (bv.get_status() == GraphicsMill.UpdateStatus.busy)
			alert("busy state");
		else
			alert("free state");
	});
});
</script>

Edited by user Monday, December 17, 2007 7:42:02 PM(UTC)  | Reason: Not specified

Sincerely yours,
Sergey Peshekhonov.

Aurigma Technical Support Team.
natebell  
#13 Posted : Thursday, July 19, 2007 10:28:44 PM(UTC)
natebell

Rank: Member

Groups: Member
Joined: 3/28/2007(UTC)
Posts: 56

Thanks Sergey, this is just what I needed!
Users browsing this topic
Similar Topics
Ajax Controls and Vector Objects and AJAX Control Toolkit (Discussions – Graphics Mill)
by NormanL 5/14/2012 9:20:02 AM(UTC)
Overlaying images and ajax controls (Discussions – Graphics Mill)
by NormanL 5/8/2012 1:23:50 AM(UTC)
Aurigma and Ajax cart (Photo Order for Virtuemart)
by Kaderas 4/3/2012 4:42:33 AM(UTC)
Flash - Ajax Uploader (Discussions – ActiveX/Java Uploader)
by cyberguy 12/15/2011 9:59:20 AM(UTC)
HOWTO: Integration Image Uploader control and AJAX ModalPopup extender (FAQ – ActiveX/Java Uploader)
by Dmitry.Obukhov 9/12/2011 1:59:01 AM(UTC)
Ajax ImageVObject Border create hairline (Discussions – Graphics Mill)
by ChingYen 11/14/2010 5:46:35 PM(UTC)
AJAX MultilayerViewer does not work on IE 9.0? (Discussions – Graphics Mill)
by ChingYen 11/11/2010 1:03:10 AM(UTC)
AJAX (Discussions – Graphics Mill)
by Chris Herrington 4/29/2009 3:14:14 AM(UTC)
AJAX (Discussions – Graphics Mill)
by Chris Herrington 4/28/2009 6:21:04 AM(UTC)
AJAX Sample Project (Discussions – Graphics Mill)
by Chris Herrington 4/28/2009 12:38:02 AM(UTC)
TIFF image rotation with Ajax BitmapViewer (Discussions – Graphics Mill)
by b.de.vries 11/26/2008 11:37:32 PM(UTC)
Possible to Update "MaxFileCount" using Ajax? (Discussions – ActiveX/Java Uploader)
by tgc 10/28/2008 11:45:53 PM(UTC)
HOWTO: Create Overview-Window for AJAX BitmapViewer (Samples – Graphics Mill)
by Alex Kon 3/27/2008 2:43:14 PM(UTC)
PRB: AJAX and Web Controls Do Not Work on Production Site when You Publish It Using Visual Studio (FAQ – Graphics Mill)
by Dmitry 2/1/2008 2:41:01 PM(UTC)
AjaxControls Access Denied (Discussions – Graphics Mill)
by John Thelen 11/21/2007 4:33:20 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.