home *** CD-ROM | disk | FTP | other *** search
- Path: red-branch.MIT.EDU!not-for-mail
- From: rid@red-branch.MIT.EDU (Shawna or Lars Hansen)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: time-like gadgets
- Date: 13 Apr 1996 02:22:21 GMT
- Organization: Massachvsetts Institvte of Technology
- Message-ID: <4kn34u$ppf@senator-bedfellow.MIT.EDU>
- References: <447.6673T637T93@mailbox.swipnet.se> <4kidsm$ci8@coli-gate.coli.uni-sb.de>
- NNTP-Posting-Host: red-branch.mit.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Martin Recktenwald (mreckt@cscip.uni-sb.de) wrote on 11 Apr 1996 07:55:02 GMT:
- : Daniel Adolfsson (m-29431@mailbox.swipnet.se) wrote:
- : :
- : : Can anyone point me in the right direction on how to create and update
- : : gadgets like the system program SYS:Prefs/Time does? (I mean how all the
- : : days gadgets change when you change the month). I just dont understand how
- : : I should do it (updating the gadgetlist or something like that..)
- : :
- : I did something like this some time ago. I used 28 - 31 old-style gadgets
- : for the days; I removed them every time the month-gadget was pressed
- : and added them at their new position.
- : The only problem was getting the day of the week a month starts with.
- : If you really need it, I could dig out the source; but I really would
- : recommend writing it yourself, my source looks somehow ugly, and
- : implementing the thing as a BOOPSI gadget could be a good idea.
- :
- : Regards,
- : Martin.
- : -------------------------------------------------------------------------
- : If you can`t understand anything above, it`s because of my bad English.
- : However, I have the right to make faults, and you have the right
- : to mail them to me ;-)
- : -------------------------------------------------- mreckt@cscip.uni-sb.de
-
- That really shouldn't be a problem. The tm struct as returned by
- localtime() will give you the day_of_week. Setting the date as the first
- of the month, and bouncing your prepared tm struct back and forth with
- the standard time functions should give you the day_of_week of the first
- day of the month. After that, it's easy placing the 'buttons' out
- calendar style...
-
- --
- * Lars M. Hansen
-