An othe idea for Global Agent Method

Share business templates, ideas, experiences, etc with fellow Servoy developers here

An othe idea for Global Agent Method

Postby elmono_acosta » Thu Jan 27, 2005 1:18 pm

Call this method form anywhere, and forget about the size of the ballon.....

globals.callAgent('This is a test for the agent......bla....bla.....');


The method is
Code: Select all
plugins.agent.show();

//Determines correct size of the baloon, depending on the amount of text.

var number_of_letters= arguments[0].length;

var c = 0;
var i = 0;
while ((i=arguments[0].indexOf("\n",i))!=-1) {
   i++;
   c++;
}


var hight = (((number_of_letters / 28)+c) * 16) + 21;

plugins.agent.setBalloonSize(200,hight);
plugins.agent.speak(arguments[0]);

//Servoy will automatically hide the baloon (time not adjustable, servoy handles it automatically. Not very good...)
//But the image of the agent will still be displayed, after the baloon hides.
//To hide the image, do this:
//The number is in seconds * 1000

var startDate = new Date();
startDate.setTime(startDate.getTime()+5000);
plugins.scheduler.addJob('HideAgent'+ startDate.getTime(),startDate,globals.hideAgent);


The method globals.hideAgent is:
Code: Select all
plugins.agent.hide();


What this is missing is been able to hide BOTH the baloon an Agent at the same time. (of course an adjustable time. !!!!)
Any ideas ???
Maybe this should all be a funtion of servoy ?????
elmono_acosta
 
Posts: 41
Joined: Thu Jun 17, 2004 11:52 am

Postby bcusick » Fri Jan 28, 2005 3:46 am

The plug-ins we provide for free are meant as examples. They are FUNCTIONAL examples, but examples nonetheless.

The source of this bean is open. You can change it however you want via Java.
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA


Return to Sharing Central

Who is online

Users browsing this forum: No registered users and 4 guests