KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Time: A NotifyIcon script that displays the current time

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Oct 03, 2005 10:02 pm    Post subject: Time: A NotifyIcon script that displays the current time Reply with quote

An example script for using the NotifyIcon class. Requires the very latest version of Kixforms.Net (3.1.15)

Code:

Break On

$System = CreateObject("Kixforms.System")

;; create an icon for the taskbar...

$TimeIcon = $System.Icon.FromBase64String(TimeIconString())

;; create our notifyicon...

$NotifyIcon = $System.NotifyIcon()
$NotifyIcon.Icon = $TimeIcon
$NotifyIcon.Text = "Displays the current time"
$NotifyIcon.DoubleClick = "DoubleClick()"

;; create a contextmenu for notifyicon...

$ContextMenu = $System.ContextMenu()

$ShowTimeMenu = $ContextMenu.MenuItems.Add($System.MenuItem("Show Current Time..."))
$ShowTimeMenu.Click = "ShowTimeClick()"

$= $ContextMenu.MenuItems.Add($System.MenuItem("-"))

$ExitMenu = $ContextMenu.MenuItems.Add($System.MenuItem("Exit"))
$ExitMenu.Click = "ExitClick()"

;; assign the menu to notifyicon...

$NotifyIcon.ContextMenu = $ContextMenu

;; make the notifyicon visible in the system tray...

$NotifyIcon.Visible = 1

;; while the notifyicon is visible, process events ...

While $NotifyIcon.Visible
 $= Execute($System.Application.DoEvents)
Loop

$NotifyIcon.Dispose

Exit 0

Function ExitClick()
 $NotifyIcon.Visible = 0
EndFunction

Function DoubleClick()
 ShowTimeClick()
EndFunction

Function ShowTimeClick()
 $= $System.MessageBox.Show("The current time is " + @TIME, "Current Time")
EndFunction

Function TimeIconString() ;; time.ico
$TimeIconString = "
AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD/
/wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAD7+/AAAAAAv7+/v7AAAAv7+/v7+wAAD7C/
v7+/AAD7+wv7+/vwAL+/sL+/v7AA+/v7AAAA8AC/v7+/v7+wAPv7+/v7+/AAD7+/v7+/AAAL
+/v7+/sAAAC/vw+/sAAAAAD7+/AAAAAAAAAAAAAAAAAAAAAAAAD8HwAA8AcAAOADAADAAQAA
wAEAAIAAAACAAAAAgAAAAIAAAACAAAAAwAEAAMABAADgAwAA8AcAAPwfAAD//wAA
"
EndFunction
Back to top
View user's profile Send private message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Oct 04, 2005 1:19 pm    Post subject: Reply with quote

what is the paramaters for an icon for the tray? size & color depth.

How do you convert it so it is embedded into the script like this?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Oct 04, 2005 1:46 pm    Post subject: Reply with quote

I just took an icon i had laying around ... time.ico ... then ran it through the base64 program like this:

base64 time.ico timer.b64

then notepaded the time.b64 file and copy/pasted the code into the TimeIconString UDF, that returns the code as a string.

The base64 program is available in the Kixforms 2 Scripted Resource development kit ... maybe i should include in the Kixforms.Net pkg ?
Back to top
View user's profile Send private message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Oct 04, 2005 2:37 pm    Post subject: Reply with quote

I would.

1 msi package with forms designer and such
1 msi package with just the dll
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Oct 04, 2005 2:38 pm    Post subject: Reply with quote

what are the limits for icons for toolbars, for listviews, for tray icons?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Oct 04, 2005 2:51 pm    Post subject: Reply with quote

When Kixforms.Net leaves Beta - the plan is to have just the DLL itself in a stand-alone msi package, then either ...

1) Package the Kixforms.Net Help, the Kixforms Designer, base64.exe and whatever else (samples etc) into a Kixforms.NET Software Development Kit (SDK).

2) Package the Kixforms.Net DLL and all the above into an SDK.

Haven't decided what I want to do - I personally dont want to maintain two msi's containing the DLL. So we'll see. The SDK will come regardless.

In terms of limits - I have no idea - haven't reached any yet (myself)
Back to top
View user's profile Send private message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Oct 18, 2005 2:54 pm    Post subject: Reply with quote

dammit... I worked on this for a half hour, before I realized I wasn't running the .net version.

aaarrrrrgggghhhhh
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group