Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Oct 20, 2017 2:43 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: jQueryProgressBar
PostPosted: Wed Jan 09, 2013 11:00 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Ok...so I've managed to get 6 more jQuery controls completed and 99% of this one:

jQuery ProgressBar:
http://www.realstudiodevspot.com/demos/ ... essbar.rbo

I believe my error lies in the constructor again as I'm receiving the:

Unexpected Token {

error...

Any help would be greatly appreciated and I'll be posting the 8 so-far converted controls on RSDS later tomorrow with the new update of the Library as well :-)

Const kConstructor:
$(document).ready(function(
{$("#<<controlid>>").progressbar({value: <<options>>});
);


Sub MakeConstructor
Dim js As String = kConstructor

js = Replace(js, "<<options>>", str(Value))
js = js.ReplaceAll("<<controlid>>", Self.ControlID)

Dim source() As String
source.Append("RSCustom.RSDS.jQuery.progressbar." + Self.ControlID + "_constructor = function(n) {")
source.Append("RS.triggerServerEvent('" + Me.ControlID + "','LibrariesLoaded');")
source.append js
source.Append("}")
Return Join(source, EndOfLine.UNIX)


Property Value as Integer

Set
mValue = value
ExecuteJavaScript("$('#" + Me.ControlID + "').progressbar({ value: " + str(value) + "});")
End Set

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: jQueryProgressBar
PostPosted: Wed Jan 09, 2013 11:53 pm 
Offline
Real Software Engineer

Joined: Tue Jul 14, 2009 4:33 pm
Posts: 146
Location: Raleigh, NC
Your constructor has a subtle bug:

$(document).ready(function(
{$("#<<controlid>>").progressbar({value: <<options>>});
);


Your Function statement is missing a close bracket and a close curly brace. For clarity, I usually write these like this, just so you don't miss anything:

$(document).ready(function() {
$("#<<controlid>>").progressbar({value: <<options>>});
});

_________________
Greg O'Lone
Software Engineer
Real Software


Top
 Profile  
Reply with quote  
 Post subject: Re: jQueryProgressBar
PostPosted: Thu Jan 10, 2013 9:15 am 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Foolish me :-(...I'll start using a javascript syntax checker (will include a feed back for this as well as it would be a great addition for WebControlWrapper), although now I'm having the following error

Could not execute returned javascript: $ is not defined
Source: var langdir = document.getElementsByTagName('body')[0]; if(langdir) { langdir.removeAttribute('dir'); }
var langdir = document.getElementsByTagName('body')[0]; if(langdir) { langdir.setAttribute('lang','en-US,en;q=0.8'); }


THE FIX (for those who may encounter this error):

In the computed property I forgot to check that the Libraries have been loaded first....upon creation of the control, the set event of the property is invoked...the libraries MUST be loaded before set can be invoked my property should look like the following:

mValue = value
if LibrariesLoaded = true then
ExecuteJavaScript("$('#" + Me.ControlID + "').progressbar({ value: " + str(value) + "});")
end if


Greg:

Would it be possible to invoke computed properties after the generation of controls?...still invoking non-computed properties before libraries have been loaded within the WebControlWrapper class? I realize this would mean a change within the WebSDK...but before I make a feedback I just want to make sure that I myself, am not doing something incorrectly. Yet it would be understood that within the WebControlWrapper that computed properties would always (in probably 90% of the time) involve some sort of javascript...which would need to be invoked after control creation rather than before?...I realize this should probably be within the beta list, although may be valuable to another community member since the WebSDK has already been released and I'd like to prevent the cascade of similar questions since someone else may search for a similar question. (Thus, why my posts are generally 'long' to ensure I include as many keywords which may be searched related to similar questions :-))

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: jQueryProgressBar
PostPosted: Thu Jan 10, 2013 10:55 am 
Offline
Real Software Engineer

Joined: Tue Jul 14, 2009 4:33 pm
Posts: 146
Location: Raleigh, NC
No. That's basic underpinnings of the framework and would break everything else.

Here's what I'd suggest: Make an array of commands to defer until after the libraries have loaded and then if they haven't loaded yet, stick them in there. Once they do load, execute that batch right away.

_________________
Greg O'Lone
Software Engineer
Real Software


Top
 Profile  
Reply with quote  
 Post subject: Re: jQueryProgressBar
PostPosted: Thu Jan 10, 2013 1:24 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Everything is coming along good so far..thanks Greg

working demo (I applied an animated background to the demo using property list) :-)

http://macrinoria.com/jquery/

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
Reply with quote  
 Post subject: Re: jQueryProgressBar
PostPosted: Thu Jan 10, 2013 2:16 pm 
Offline
Real Software Engineer

Joined: Tue Jul 14, 2009 4:33 pm
Posts: 146
Location: Raleigh, NC
Something to note. You notice that when the page initially draws the controls are unstyled and off to the top/left? It might be worth waiting until the Shown event to set the visibility of the controls to "visible". You can do that later using javascript:

ExecuteJavascript("RS.get('" + self.controlid + "').style.visibility = 'visible';")

_________________
Greg O'Lone
Software Engineer
Real Software


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group