Alpha Video Training
Results 1 to 11 of 11

Thread: Digital Clock

  1. #1
    Member
    Real Name
    Harold Laski
    Join Date
    Oct 2005
    Posts
    94

    Default Digital Clock

    I would like to put a realtime digital clock that includes the day of the week, date and actual current time clicking off in seconds on a form. I have seen several shwoing analog clocks that go on the toolbar but I want this on a form

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,313

    Default Re: Digital Clock

    Ok. What have you tried? Where are you stuck? The onTimer event for your form can be used to run a short script that updates displayed values in your form layout. Why not take a crack at building these on your own?

  3. #3
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: Digital Clock

    Quote Originally Posted by hsl9999 View Post
    I would like to put a realtime digital clock that includes the day of the week, date and actual current time clicking off in seconds on a form. I have seen several shwoing analog clocks that go on the toolbar but I want this on a form
    Take a look at post. There is an example of a seven segment display. This can be used as example to create your own clock. Have fun!
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,865

    Default Re: Digital Clock

    This is a really simple one... don't know if it's what you're looking for... but you can easily change it around. I kinda based this on the A5 sample xbasic database that includes the "Clock" UDC. I didn't have to do any fancy polygon stuff but it does use some api calls. There is one problem however... the minutes tick over when seconds hit 30... I can't see why... anyone else want to have a look?

    There are two forms to have a look at here... sfrmDigiClock and frmMainwithDigiClock. The sfrmDigiClock I named as a sub-form. The Main form has a sub-form pointing to sfrmDigiClock which shows you can use the sub-form on any form. I would have liked to create a true UDC but yikes that's a lot of work... so I just used frames.

  5. #5
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Digital Clock

    Thanks for the multiple examples David.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,865

    Default Re: Digital Clock

    It occurred to me this morning... are the examples of the Clock and Slider controls really UDC's? I would think the definition would include being able to "dock" a control in with the Alpha form controls and therefore be able to get at it easily. As well, a "control" would have right click properties to get at. So really, these are just involved xbasic programs. That's ok with me... I just wouldn't call them User Defined Controls.

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,865

    Default Re: Digital Clock

    Found out why the minutes are clicking over at 30 seconds. This makes sense for an analoge clock in that the minutes hand is always moving and at, for example, 3.5 minutes you're MODing up to the 4th minute... at that point.

    So, change the code for minutes to the same as seconds... take an INT of the MOD and all is well.

  8. #8
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,865

    Default Re: Digital Clock

    ... and you have to do the same for hours.

  9. #9
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Digital Clock

    To all,
    This code is located on the OnTimer event.

    David,
    Personally I prefer it as it was as then the minute hand moves according to how many seconds have passed just as a real clock hand moves....with the change the minute hand (and hour hand also) remains stationary until a full minute (full hour) has passed---then abruptly moves a full minute (full hour).
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  10. #10
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,865

    Default Re: Digital Clock

    Hey Mike,

    The changes are only for the digital version. Looking at the analog clock made me realize the change that was required for the digitlal clock. I love the way the hands move throughout the minute and hour on the analog clock. But the code doesn't work for the digital - it has to be exact.

  11. #11
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Digital Clock

    yep--made the changes...makes sense. Thanks again David for these samples.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




Similar Threads

  1. Digital signing
    By Dennis Mathias in forum Alpha Five Version 7
    Replies: 5
    Last Post: 12-03-2005, 12:59 AM
  2. Digital Photos
    By ian wood in forum Alpha Five Version 5
    Replies: 1
    Last Post: 10-10-2003, 02:30 AM
  3. Digital Media Databases
    By Harvey Kreitenberg in forum Alpha Five Version 5
    Replies: 0
    Last Post: 10-03-2003, 05:43 PM
  4. Digital Signatures
    By Rick Hamilton in forum Alpha Five Version 5
    Replies: 0
    Last Post: 09-22-2003, 05:15 PM
  5. Hello from the digital edge!
    By John Martin in forum UK Users
    Replies: 2
    Last Post: 05-09-2002, 04:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •