DesktopX: Creating a simple clock widget

A quick tutorial

Wednesday, March 23, 2005 by Frogboy | Discussion: DesktopX Tutorials

Alberto Riccio, the lead developer of DesktopX 3 has written this great little tutorial on how ot create a simple clock widget for DesktopX.

How to create a really simple clock widget

  • Make sure DesktopX is in authoring mode. Right click the DesktopX systray icon. If you see "Switch to Authoring mode", then select it.
  • Right click again the DesktopX systray icon and select "New Object".
  • A new object is created and the Properties panel for it is opened.
  • Go to into the States tab and changes the Appearance type to Text as shown below.

  • Tweak the font and text options as you wish.
  • Go back into the General tab and click New in the Script section.

  • The DesktopX Script Editor opens.

  • Now copy and paste the following code into the editor:

'Called when the scriptis executed
Sub Object_OnScriptEnter
Object.SetTimer 444, 1000
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 444
End Sub

Sub Object_OnTimer444
Object.Text = Now
End Sub

  • Close the editor. Click Ok in the Properties panel.
  • The object should appear similar as this one:

  • Sure, there is more work to do regarding the formatting, but this is only a simple tutorial.
  • You want now turn it into a widget.
  • Right click on it and select Export...
  • Choose "Export as a widget". Click Next.
  • Enter some basic information like Widget name, Author and Accessibility.
  • Click Next and browse the Save as File name, then click Finish.
  • The beauty of Widgets is that they are stand alone applications, so they can be run without DesktopX running in background. You only need to have DesktopX installed. Plus they can be optionally accessed via System tray or Windows taskbar.
  • Close DesktopX now.
  • Run the newly created EXE.
  • You can see the widget appearing in the very same location.
  • You can right click and access widget options.

  • Most options should be pretty straightforward, however they are fully covered into the DesktopX documentation.


 

butch123
Reply #1 Wednesday, March 23, 2005 10:35 PM
Very helpful..thank you.
ExodusCrow
Reply #2 Wednesday, March 23, 2005 11:27 PM
If only more people knew DX was THIS simple! Another great little tutorial. Thanks.
JavaScout
Reply #3 Friday, March 25, 2005 3:46 AM
If you prefer JScript here is how the functions would be coded

//Called when the script is executed
function Object_OnScriptEnter()
{
Object.SetTimer(444, 1000);
}
//Called when the script is terminated
function Object_OnScriptExit()
{
Object.KillTimer(444);
}

function Object_OnTimer444()
{
Object.Text = String(new Date());
}
nocool
Reply #4 Monday, March 28, 2005 3:28 PM
Why use any script at all, can't you make the whole thing with just mouse clicks?
TYCUS
Reply #5 Monday, April 4, 2005 10:01 AM
and what if i want to do a clock with a image

-=TYCUS=-
Fairyy~
Reply #6 Friday, May 27, 2005 11:59 AM
[TYCUS]
and what if i want to do a clock with a image


~That was my question. How do you make the widget if you have a background and frame and you want the clock inside it ?
Grimnir M
Reply #7 Friday, June 17, 2005 11:03 PM
as far as a regular time text there is an easier way that i used. In the DX Player plugin under text display there is a selection titled 'Time' or 'Time (24hour)' the same could be done with the date.
I had to look for those options in DX 3 because the plugin had been removed in the 3rd version.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01