Continuing the previous tutorial.
If you look at the 2 images below you will see the 2 images we want to use for "Mini" and "Large".
To keep everything in place and make life a LOT easier, i have made a very simple "box" image that is just a 5x5 pixel image that i make whatever size i want and then when im done, i make it transparent. This searves as the "parent" object for the differnet Modes of the gadget.
In this case we have 2 main images, that we want to line up so that the countdown text area lines up exactly.
Lucky the 2 images were made using the same items, so the little "countdown" are are the exact same.

Lets go thru this 1 step at a time.
Make the "MasterBG" item.
Again, I just used a simple 5x5 pixel box that is blue. You can make one easily with PAINT if you want, but to be honest ANYTHING would work, it will end up transparent, i like this one cause its VERY small.
Create a new object, pick the simple image you want to use, and then make it's size around 400x400 pixels, this will serve as our "background" for the other objects to be children of.
Here are 2 simple shots of what the properties look like:

You can see i love to use names for these objects that are UNIQUE as i might have multiple projects on the screen at once, and if they are all called "background" or "master" it would not work! In this case its called "Birthday-CD-MasterBack" for Birthday Countdown Master Back. You can name it whatever, you will also see its part of a group and widget called "BirthdayCountdown".
Setup the (2) Images MINI and LARGE as "children" of the MasterBG item:

Notice the "PARENT/OWNER" as "Birthday-CD-MasterBack".
Also look at the Top/Left location on each of these, the way i lined these up was to take and show both of them, then make the mini one about 80% transparent so i could see the LARGE one under it, and i kept moving it around till they lined up.
One easy way to do this is to use the "LIST" view that looks like:

The best reason for using the "Object Navigator" is becasue it wont force the scripts to re-load each time you move things around.
I didnt cover this in "detail" in the previous step, creating and adding the hrs/mins/sec/days text objects.
Simply create 4 new text objects, set the font, color, etc to what you want, name them as shown and then i also made a "background" item for them so they would stay "grouped" and allow me to move them around or to hide them if i wanted to.
Make the TIMEBACK object just like we made the other master bg item. This one is really small, and then make the (4) previous text objects as "children" of this. Just like we did above.
I know im skipping some things, but there are much more detailed tutorials on this, and this is more like a step-by-step on how im making this gadget.
ADD THE MINI/LARGE Buttons:
I had these 2 little buttons from a previous gadget. What was done was to create (2) more objects:
Birthday-CD-MiniModeBTN and Birthday-CD-LargeModeBtn
Each has a mouse-over and mouse-away state (use any images you want, like i said i used ones i had before that look like little arrows).
Click the "NEW" button to create an "EMPTY" script, we will NOT be putting the control for the buttons in each object but in the master object, where ALL the scripts reside. Again, I have put ALL the code into the Master BG item. This way I have all my code in one location.
ADD THE CODE FOR THE BUTTONS:
Please look at Step 2, as im keeping all that code and only adding the following to it at the bottom:
I LOVE being able to make 1 script for all this, it saves so much time, and makes things so much cleaner.
Code: vbscript
- Function Object_OnLButtonUpEx(obj,x,y,dragged)
- If Not dragged Then
- Select Case obj.name
- Case "Birthday-CD-LargeModeBtn"
- desktopx.object("Birthday-CD-MiniBG").visible = False
- desktopx.object("Birthday-CD-LargeBG").visible = True
- Case "Birthday-CD-MiniModeBTN"
- desktopx.object("Birthday-CD-LargeBG").visible = False
- desktopx.object("Birthday-CD-MiniBG").visible = True
- End Select
- End If
- End Function
This code activates when any object (with a empty script) is clicked.
It checks to see that you did not DRAG the object around, and if you did it ignores the mouse button.
It does a "Select Case obj.name" - this is a simple function that is like a combined IF statement. Each "CASE" under this statement will allow you to do something different for that item.
In this case:
- Case "Birthday-CD-MiniModeBTN"
This checks to see what the object.name was that was clicked.
If it was the MiniModeBTN it will do the lines below it.
in this case it makes the the LARGE object's visibility = false --- ie it HIDES it.
Then it SHOWS the MINI object
- desktopx.object("Birthday-CD-LargeBG").visible = False
- desktopx.object("Birthday-CD-MiniBG").visible = True
The other button does this for the LARGE Button, so this one little bit of code works easily for both buttons.
The idea will be to maybe make them "fade" in and out via a little script (if i get bored), and if so i can add that function to this section, instead of having to edit each item's script individually.
So, at this time we have a working countdown that has a MINI and LARGE mode. It is hard-coded to countdown to MY birthday at this time. And why not. LOL. I will work on that in the next step.
PLEASE let me know if this is helpful, or stupid.
RomanDA