Author Topic: Vista Gadget  (Read 5881 times)

0 Members and 1 Guest are viewing this topic.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Vista Gadget
« on: September 19, 2007 »
Hey. I was just wondering if any here knows how do make a Vista Sidebar Gadget? (those things in the sidebar... lol) I know they are XML and... umm, some other language, but I'm not going to be able to code it! :(
I'm asking because my boss would like a gadget for our live Internet stream (like the Ministry of Sound gadget)...
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vista Gadget
« Reply #1 on: September 19, 2007 »
I don't know anything about it, but this tutorial I found shows some promise
http://microsoftgadgets.com/Sidebar/DevelopmentOverview.aspx#sidebarArchitecture

Jim
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #2 on: September 19, 2007 »
Thanks Jim!!!  :carrot:
Looks easy. Might post it up when it's done - maybe someone here will like the stream we offer :)

I was just wondering though. To make it a package - able to install into the gadgets folder thingo - how would this be done?
We would like to upload it onto our web site so our visitors can download it and just install it, rather than looking for the folder to make it appear in the GADGETS ADD...
We don't want to have a READ ME saying: "When you Unzip this, copy and paste this location [shows location] into the Unzip To Here box..."

We just want a nice installer, included in the download to save it to the right location.  :updance:, thanks!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vista Gadget
« Reply #3 on: September 19, 2007 »
I've always used Inno Setup to make my installable packages.
http://www.jrsoftware.org/isinfo.php
The old versions, 3.0.x, are really, really simple to use.

Jim
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #4 on: September 21, 2007 »
Ahh... finished 90% of the gadget.
My bosses are really impressed. They did the Logo in one of the 3D editing suits (think Light Wave or something). I did the buttons (play and stop), and my bosses were very impressed. They just happened to become very relevant to the colour of the gadget background.
Well, after a day in the office, I'm proud of what I, and two others have done. I've attached the gadget within a zip folder (extract and install).
Researching how to package the gadget today revealed an interesting method.
All you need to do (no packaging software required) is to copy the files into a zip folder (this caused trouble because we had WinRAR and it wasn't working in the end) and rename the file extension to .GADGET. wow! Simple.
Hope all you vista users enjoy (not so many I take it haha).

--As always, a question.
We have all the basis done. But I was wondering how I could implement a scrolling live track display? (I have already tried, the scrolling is there, but I cant get the track information off the TrackService html.
Does anyone know how this could be done? My bosses will be very pleased haha, we tried all day!
Oh yea, and the scrolling text is not hidden on the right padding... another question arised: (It does get hidden, but it is still starting right at the edge)... Is it possible to make it hide until a certain point? I padded the left side and it works fine... and I'm guessing the padding on the right side wont affect it? We wont it so both sides are even when text is displayed.

Enjoy! And hopefully you guys will like the music in the play lists I (randomly) generate using DOS based software (if you would be kind enough to listen hehe).
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vista Gadget
« Reply #5 on: September 21, 2007 »
I'm no expert, but can't you just put the scrolly message in a frame?
Well done on getting it going :)  I think you deserve some special-K.

Jim
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #6 on: September 23, 2007 »
ahh! Great idea Jim... I'll try and include a table into the body! Hopefully it works... and hopefully I haven't said this and it's totally not going to work lol.
Glad you like it :P

I've emailed my sisters boyfriend (because he did Business / IT... with Java knowledge haha!) to help with the 'get track information'. Hopefully he can get something working.

---edit---
Nah, couldn't get it done... :(
What a bummer. Don't think tables are the way to go... and I haven't learnt about fields yet in HTML so no go with fields... damn!
Well... I guess it's ok. But we won't release (add as a download from our page) until next Friday - so there is still time.

Oh btw. Did you notice the link to our home page?? Just curious to whether it's easy to realise that there is a link on the gadget?
« Last Edit: September 23, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Vista Gadget
« Reply #7 on: September 23, 2007 »
Looking good, only one problem: the text starts a pixel or two outside of the box?
othervise it works fine :)
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #8 on: September 23, 2007 »
Yeah, that's what I'm trying to fix... along with the availability of getting the track information.
A thought: Is it possible to get information via java script off of a html site (as ours is). Or does it need to be PHP?

I think I have a solution for the track information... I checked the KIK website and viewed the source to see how they got the track information... hopefully this works...

---Edit---
Damn... it did work... but it wasn't refreshing... and the code created an iframe, causing everything to skew. So scratch that bright idea haha.
Let the saga continue :P
« Last Edit: September 23, 2007 by CLANKY »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vista Gadget
« Reply #9 on: September 23, 2007 »
I bet if you asked p01 he would help you.  He's an expert on this stuff.

Jim
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #10 on: September 23, 2007 »
Ok, I'll give him a PM? Nice, hope he (she) can help.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: Vista Gadget
« Reply #11 on: September 27, 2007 »
Sorry guys, I saw your PM earlier and tried to cook a slick cross browser scrollTexts manager but had some issues with this junk of IE6, and got drained into other things like work :p. I finally managed to get this little scrollTexts manager working. See the file attach, and let me know if you don't understand something.

Anyway. The basic idea behind scroll texts using web standards obviously relies in CSS.
First you need a container in non static position ( i.e.: in absolute, relative or fixed ) and overflow:hidden so that it will clip the nested content. Which content is in position:absolute; Then initiate the regular update of the position of the content using a setInterval( functionHandle, delay );

The offsetWidth and offsetLeft properties will return the width and left respectively of an element. Use them to place the content as you wish within its container.


Oh, and last but not least, I'm a "he", not a "she" ;)


Hope that helps,

:cow:
« Last Edit: September 27, 2007 by p01 »

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vista Gadget
« Reply #12 on: September 27, 2007 »
Thanks!
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #13 on: September 28, 2007 »
Thanks p01 for taking the time to code something!
Much appreciated!
I'll check it out... we have released a version one (my boss scrapped the scroller, and created a stepper. owels! next version will use the scroller and have the track information)
 :updance:
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: Vista Gadget
« Reply #14 on: September 28, 2007 »
You're welcome.
More important than the code is to understant the how to. The code is just to illustrate one possible implementation.

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #15 on: November 30, 2007 »
Ok!
A new update has been added to our site... boy its great!
I did it all myself...
There were a few bugs and stability problems caused by error and badly coded bits of the older gadget... I set out to eradicate these issues with much success :D
The newest update (I have attached it) features a more stable body (it doesn't 'crash' when you open/close the settings) and allows the user to stop streaming when it connects (heaven forbid you decide not to listen in the short period you have when it connects to our server).
I also made 'improved' backgrounds and buttons (for later updates, when I can get my head around coding the settings to allow changeable backgrounds and buttons) and I also made a spiffy new icon to appear in the Gallery.
I also added a few minor touches  - made the KIK DARWIN link more accurate, and fixed the description, added Email Us and Visit Us to settings window...

Hmm. Hope you guys enjoy (if you would like to use the gadget, change the extension to [dot]gadget).

--
I am still confused about how to get the track information!
I'll keep trying... this update was 'middle' so it wasn't full of the features I wish to add.
Also, with the scrolling text (controlled within JS), the text increases its speed every time you press STOP then START... hmm! Why is this? I said:
Code: [Select]
function controlImageClick()
{
if (controlImage.src == "images/stop.png") {
mediaPlayer.controls.stop();
} else {{
mediaPlayer.controls.play();
pos = 0;
clearTimeout(timer);
startScroll();
}
mediaPlayer.controls.play(); startScroll();
}
}
I thought this would make the scroll speed reset???

Thanks! And enjoy!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: Vista Gadget
« Reply #16 on: December 06, 2007 »
--sorry for the double post... and the novel writting :P
it must be  :xmas:  haha!

------
Hi guys.
I fixed the 'clipping' problem of the right side... (had a read of P01's great demonstration of scrollers in JS and HTML)...

I also read up on AJAX, and found a way to rip information from server files and place them into HTML div's... great great! This has allowed us to get one step closer to finally creating a gadget that we can call 'finished'.
The track information works! AJAX rips the info great!!! So, we have a live track update... sort of... unfortunately, for some reason, the track information doesn't change after you have obtained it upon connecting.
I first decided to use the XML document on our server, but the information was coming down as the whole file (including tags)... so I decided that it would be best to make a text document to be parsed through out HitPlayer, and only have the Song Title and Song Artist displayed... I could say it would look like the attached text file, being updated every event change (done by our HitPlayer). This means the AJAX will rip the whole song title AND song artist as one line, and change that to the current song for the message in the HTML (if when the interval triggers another 'get' and the string is different).
I'm not sure why it isn't changing the song! When I restarted my computer, it changed! But it won't change 'live' when the gadget is on, or even with the SideBar restarted!

I have attached both the demonstrative text document and my AJAX JavaScript file is below. Can someone please have a sift through (you only really need to worry about the AJAX bit, the other is just sorting out the play/stop and images)...

Also! Why is it scrolling faster after every play/stop hit!?

Thanks!

Code: [Select]
var audioURL;
var trackURL;
var updateInterval = 5000;
var output = "       KIK LIVE Stream          kikconnect.net";
var song = "       KIK LIVE Stream          kikconnect.net";
var pos = 0;
var timer;
var status = false;

window.onload = function()
{
audioURL = "mms://win4.fast-serv.com/kikfm";
trackURL = "http://www.kikconnect.net/TrackServ/live_update.txt";
mediaPlayer.url = audioURL;
System.Gadget.settingsUI = "Settings.html";
}

function AjaxGet()
{
if (status) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = infoReceived;
req.open("GET", trackURL, true);
req.send();
}
setTimeout("AjaxGet()", updateInterval);
}
}

function startScroll()
{
var s = "       " + song;
if (s.length > 28) {
pos += 0.25;
if (pos >= s.length + 15) {
pos = 0;
}
message.innerHTML = s.substring(pos, s.length);
} else {
message.innerHTML = song;
}
timer = setTimeout("startScroll()", 80);
}

function infoReceived()
{
if (req.readyState == 4) {
if (req.status == 200) {
output = req.responseText;
if (output != song) {
song = output;
message.innerHTML = song;
pos = 0;
clearTimeout(timer);
startScroll();
}
}
}
}

function controlImageClick()
{
if (controlImage.src == "images/buttons/stop.png") {
mediaPlayer.controls.stop();
} else {{
mediaPlayer.controls.play();
pos = 0;
clearTimeout(timer);
startScroll();
}
mediaPlayer.controls.play();
startScroll();
}
}

function playStateChange(newstate)
{
switch (newstate) {
case 1: // Display Player Status as Stopped
status = false;
if (timer != null) {
clearTimeout(timer);
}
song = "";
pos = 0;
message.innerHTML = "       KIK LIVE Stream          kikconnect.net";
playbackStatus.innerHTML = "Stopped";
controlImage.src = "images/buttons/play.png";
break;

case 3: // Display Player Status as Playing
AjaxGet();
status = true;
playbackStatus.innerHTML = "Playing";
controlImage.src = "images/buttons/stop.png";
break;

case 6: // Display Player Status as Buffering
playbackStatus.innerHTML = "Buffering";
controlImage.src = "images/buttons/stop.png";
break;

case 7: // Display Player Status as Waiting
playbackStatus.innerHTML = "Waiting";
break;

case 8: // Stopped Media
playbackStatus.innerHTML = "Media Ended";
controlImage.src = "images/buttons/play.png";
break;

case 9: // Connecting to Media Stream
playbackStatus.innerHTML = "Connecting...";
controlImage.src = "images/buttons/stop.png";
break;

case 10: // Display Player as Ready
playbackStatus.innerHTML = "Ready";
controlImage.src = "images/buttons/play.png";
break;
}
}
« Last Edit: December 06, 2007 by Clanky »
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..