Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Feb 23, 2020 12:21 am

All times are UTC - 5 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [WEB] Need to implement Custom Events ? [free class]
PostPosted: Fri Oct 28, 2011 12:06 pm 

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Hi everyone,

If you have some trouble finding a way to implement your own JavaScript files working with Real Studio Web Edition then you can download the class WebEventDT (DutchTools* class).


Notes (above is latest):
- It's version 1.0 i'm working on updates.
- Currently it has an "xdt:" prefix (without the quotes).

What can it do:
- You can have as many parameters as you want (handle them as strings, it's a string-array).
- You can have 1 event at a time (to be fixed later for more events in 1 call).
- You can set a boolean value for "RemoveEventWhenDone" (2nd) Parameter of the "WebEventDT.getCustomEvent" shared method to automatically remove the event string from the Session.HashTag to make it less visible to the user.
- Get the event name (String)
- Get the event parameters (String Array)

Updates needed (please contribute and email me with the updates, don't have my email? give me a PM i get you my email =>for anti-SPAM reasons):
- Handle more events in 1 call
- After the event is read or extracted from the HashTag, renew the hashtag with the default value (pagename or whatever) that is after the events last ";".
- Add some more features into this.

An example of usage...
When you have a WebPage, add a Button Called Button1 (or replace the names below).
In the button1.Action event:
ExecuteJavaScript("window.location.hash = 'xdt:TestEvent:Parameter1,Parameter2,Parameter3'")

In the Session.HashTagChanged event place this:
'Check for events:
dim CustomEvent As WebEventDT
CustomEvent = WebEventDT.getCustomEvent(Session)

if CustomEvent <> nil then'only if whe have got an event
PageHome.MsgBox CustomEvent.Name + " has fired with params: " + Join(CustomEvent.Params,",")
end if

Now run the Web Application (debugrun) and press your button.
You should see a MsgBox with the information and the "#xdt:" with event (in the addressbar) should be cleared right away.

the url that's left over should look something like this
The url with the event was: ... arameter3;

DutchTools is community freeware, it's free if you contribute anything from information to classes you decide what you give back. (it's also free as in "Free" beer)
It's under the MIT licence ("AS IS", no guarantees)

- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group