[HD2 Windows Mobile 6.5 Themes and Apps] rat_2665:
Guide for clock widgets

This is a little guide for clock widgets:

Read at first the widget development guide by Cokie (it's in the below mentioned kitchen) !!!

Step 1 manila hash names

1. Download the kitchen for the analog clock widget by cookie and make a temp folder in there. Copy the files for your analog clock in this folder (best if you have already a working clock for CHT 1.8.5). Save the pictures out of the qtc manila files as png in this folder (this is only useful for oversight). Rename the whole widget with your widget name.

2. Make a list with new names for your text and image objects with manilaHASH.

- the names should be unique. I use my name and a widget number as prefix, f.e. rat_w001_secondHand

- determine the manila hash name. For this use the line

\windows\htc\home\assets\images\Home\VGA\Your_Name.qtc

Save this list. You need it all the time for oversight.

3. Rename your images in the temp directory with the new manila names (this is only useful for oversight); then rename also your manila image files with these names.

4. Delete all files in the workspace\qtc directory and copy your new manila files into this (but not the old 1E1A6CCD_manila and 1EC5924B_manila)

Step 2 mode9 file.

5. Open the mode9 file in the workspace directory. Go in the library to the StandaloneAnalogclockGroup. There are the image and text objects for the clock.

6. If you have more objects in your old 1E1A6CCD_manila file for your analog clock add these objects in the group.

7. Then substitute

- for all objects the Instance value with your new name (f.e. rat_w001_secondHand),

- for the image objects the Texture path with the (here shortend) string that you used for the manila hash name (f.e. .\Assets\Images\Home\VGA\rat_w001_secondHand.qtc)

- for the text objects the String value to the variable used in the lua file (f.e. rat_w001_weekday). If you want to use AMPM like in the normal clock, don't change this value.

8. Change the name of the StandaloneAnalogClockGroup to a unique name (that is used later in the lua files, f.e. rat_w001_ClockGroup)

9. Change the name of the StandaloneAnalogClockAnimationLayer to a unique name (that is used later in the lua files, f.e. rat_w001_ClockAnimationLayer)

10. Save the file.

Now to the lua files.

Step 3 CHTWidgetDev

Substitute all uses of wAnalogClock2 with a unique name (f.e. w_rat_w001_Clock). You can do this in Notepad2 with the Edit/Replace function.

Then substitute in line 69 StandaloneAnalogClockAnimationLayer with the new unique name you used in the mode9 file for the animation layer (f.e. rat_w001_ClockAnimationLayer).

Do the same in line 74, 135, 136, 191, 195 and 212 for all uses of StandaloneAnalogClock (f.e. rat_w001_Clock)

Replace the string in line 28 with the name of your widget (f.e. "rat_w001_clock").

In the next line insert the string that is shown for the widget in the home layout (f.e. "my analog clock").

For an analog clock you don't need to change the next item (""Clock").

In line 70, 135 and 136 is the image object for touching mentioned. You have to substitute "SACFace" with your image object (at best the greatest, f.e. rat_w001_clockface)

The last part is line 73 and 74. In line 73 you have to substitute "Co0kieAnalogClock2" with the name of your special lua script (f.e. rat_w001_clock).

Line 74 is the bridge to your lua script. Here are the arguments of the ClockClass defined that are used in the StandaloneAnalogClockClass.__init function in your special lua file. Of course the name of the function is later also to be changed.

In the example it is:

rat_w001_Clock = rat_w001_ClockClass(rat_w001_ClockGroup, rat_w001_clockface, rat_w001_minuteHand, rat_w001_hourHand, rat_w001_secondHand)

Step 4 special lua file

For naming use the lua script file name you used in the CHTWidgetDev.lua file (rat_w001_clock)

In the first (commentary) line change the location with the new name instead of Co0kieAnalogClock2 and use the manilaHash app with this string:

\windows\htc\home\scripts\home\your_widget_name.luac

Then substitute also the manila name (f.e. -- File name: 1F2E1A7D_manila --\windows\htc\home\scripts\home\rat_w001_Clock.luac)

Substitute all uses of StandaloneAnalogClock with your name (rat_w001_Clock)

Change all uses of SACShowAMPM to your name (rat_w001_ShowAMPM).

That would be all if you only want to make a normal analog clock widget, but if you want to change more you have to go to the central function for the behaviour. For this you have to look in this two functions (these are the old Co0kie names):

StandaloneAnalogClockClass.UpdateTime = function(self)

StandaloneAnalogClockClass.UpdateSecondHand = function(self)

Here the update interval and the rotation of the hands is defined. In Co0kies clock it is pretty simple. If you want to add more functions here is the place. The names of the standard arguments clockGroup, clockFace, minHand, hourHand and secondHand should be unchanged in the whole file. For every other variable and object use your special unique name.

Of course you can add other functions in their own place. You find examples for this in my clock thread.

Now it is testing, testing, testing.

Step 5 bat.files

In the kitchen there are these two files

_Deploy_to_device_in_dev_mode.bat

_Generate_files_for_cab.bat

for handling in the development process.

Here you have to substitute in both files in the second luatool line 35E966AF_manila ..\Workspace\_lua\Co0kieAnalogClock2.lua

with your new widget name and its manila hash name. (in the example: 4C0089BA_manila ..\Workspace\_lua\rat_w001_Clock.lua)

Step 6 CHTS file

Rename the file in the CHTS with your new widget name (f.e. CHTWidget_rat_w001_Clock.xml).

Open the file with the windows editor.

Take your list with the manila hash names and substitute the objects with your new names and the manila names.

For the third line use your widget name and in the fourth line ("description") the string you used in the CHTWidgetDev.lua for the home layout description.