How to show time on form constantly updating?

p_vikas_goudp_vikas_goud Member Posts: 16
Hi experts,

Please tell me

1.How to show systems time constantly updating?

I have tried with TIME function which is showing systems time, but it is not updating with the systems time.

2.I have created a form with three fields code1(code datatype), code2 (code), code3(code)

My question is when I type 'A' in the first field and 'B' in the second, then I should get 'AB' in the third field, is there any way to get.

Actually I got struckup with same kind of scenario

Help me out guys.
goood

Comments

  • DenSterDenSter Member Posts: 8,304
    Each form has a 'TimerInterval' property. Set this to for instance 1000 for one second, and the form will fire the OnTimer event every second. Put some logic into the trigger to update the textbox that holds your time.

    So in your case I would think about adding a global variable 'MyTime', data type time, and set that as the 'SourceExpr' of a non-editable text box. Then in the OnTimer event, you program:
    MyTime := TIME;
    CurrForm.UPDATE;
    
    and that should take care of it.

    Depending on how accurate you want the time on your form to be, you can set this to any value you want, it is expressed in milliseconds.
  • Revolution1210Revolution1210 Member Posts: 161
    To show constantly updating time on a form:

    You can either use the Forms own OnTimer() event or the Navision Timer automation controller. I would go for the later.

    Create a text variable to hold the time and place a text box with this as the Source Expression: e.g., CurrentTime

    Create an automation type variable which points to the Navision Timer 1.0 automation controller: e.g., Timer

    Make sure you set the WithEvents property on the automation variable to Yes

    Initialise your time and display:
    CurrentTime := FORMAT(TIME);
    
    CREATE(Timer);
    Timer.Interval := 1000;
    Timer.Enabled := TRUE;
    

    Place this code on the Timer::Timer(Milliseconds : Integer) trigger
    CurrentTime := FORMAT(TIME);
    CurrForm.UPDATE;
    

    In the example above, the clock will update every second. Change the interval to whatever you require.
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • DenSterDenSter Member Posts: 8,304
    I think that complicates it needlessly. Every form has a built in timer, and that's the easiest way to go about updating the form every second. I do like the FORMAT suggestion, you can even format that in different ways. The basic idea is exactly the same though.
  • themavethemave Member Posts: 1,058
    Savatage wrote:
    don't download the clock if you are an end user

    it is numbered - form 50100 and unless you purchased extra forms beyond the first 100 that you can't open it up. and if you are not a developer then you can not edit the text file and change the number to one you can use

    and if you are like me and forgot that, and downloaded it, now you can not just delete it either, because you don't have premission to access it.

    reading the description it says it is
    This analog clock is build in obect F 50010

    but it is actually 50100 not 50010
    ops,
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    themave wrote:
    reading the description it says it is
    This analog clock is build in obect F 50010

    but it is actually 50100 not 50010
    ops,

    Thanks for pointing that out, in a subtle way ;-)
    I have changed the description. Will modify the object in a lower range, if you insist.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Revolution1210Revolution1210 Member Posts: 161
    DenSter wrote:
    I think that complicates it needlessly. Every form has a built in timer, and that's the easiest way to go about updating the form every second. I do like the FORMAT suggestion, you can even format that in different ways. The basic idea is exactly the same though.

    Don't think it's complictiong things - Both methods I think are viable though :D

    Using the Navision Timer gives you a bit more control and scope to expand the functionality in the future if required.
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • SavatageSavatage Member Posts: 7,142
    themave wrote:
    reading the description it says it is
    This analog clock is build in obect F 50010

    but it is actually 50100 not 50010
    ops,

    Thanks for pointing that out, in a subtle way ;-)
    I have changed the description. Will modify the object in a lower range, if you insist.

    Don't know how many people will want/use it but to make life easier I think the fob should be changed to form 50088 or something. tho the text file does show you what you need to do to make your oen form.
  • themavethemave Member Posts: 1,058
    Savatage wrote:
    ...Don't know how many people will want/use it but to make life easier I think the fob should be changed to form 50088 or something. tho the text file does show you what you need to do to make your oen form.
    your are correct in that the text files shows you how to make the form, but if you don't have developer license you can not access cal/code in forms so you can program it.

    the end user form designer only allows you access to change how thing appear. but doesn't allow access to cal/code.

    without application designer, the only place you can get to cal/code is in reports and dataports
  • william_akihisawilliam_akihisa Member Posts: 14
    try this,
    create new text box for timer, named it txtTime
    create new variable timer as time
    open property form, set TimeInterval = 1000

    then in OnTimer trigger form, type this :
    timer := time;
    CurrForm.txtTime.UPDATE;

    it will not affect on other objects in the form..
    and will do correctly..
Sign In or Register to comment.