Options

how to move image in the form

gpriyagpriya Member Posts: 17
Hi,
Iam facing one problem. I created one form and in that I put one label and one command button. I wrote the code in the command button as follows.


IF i = 0 THEN
REPEAT
CurrForm.Image.XPOS := i;
SLEEP(10);
i += 1;
UNTIL i = 10000;

when i click the command button the label is not moving slowly. once the loop is completed then only it is jumped from X position 0 to 10000. It is not moving slowly.

How can I show the label with slow movement.


Thanks in Advance,
Priya

Comments

  • Options
    thmartinthmartin Member Posts: 90
    Instead of sleep I would use the timer of the form.
    Set the TimerInterval property of the form and put your logic in the OnTimer trigger.
    Thomas Martin
    NAV Developer
  • Options
    vijay_gvijay_g Member Posts: 884
    try with increase sleep time.
  • Options
    geronimogeronimo Member Posts: 90
    the problem is that the controls arent refreshed while in the loop from what i can see.

    you could try a currform.updatecontrols or a currform.update
  • Options
    kinekine Member Posts: 12,562
    Yes, you need to force currform.update to "redraw" the form, else it will update after the process finishes...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    vijay_gvijay_g Member Posts: 884
    thmartin wrote:
    Instead of sleep I would use the timer of the form.
    Set the TimerInterval property of the form and put your logic in the OnTimer trigger.
    But it will continiously execute to timer trigger unless we don't press command button that can be cause to performance of form ...!! :(
    better is to use currform.update or currform.updatecontrol.
  • Options
    MBergerMBerger Member Posts: 413
    vijay_g wrote:
    thmartin wrote:
    Instead of sleep I would use the timer of the form.
    Set the TimerInterval property of the form and put your logic in the OnTimer trigger.
    But it will continiously execute to timer trigger unless we don't press command button that can be cause to performance of form ...!! :(
    better is to use currform.update or currform.updatecontrol.
    to be honest, personally i wouldn't put animations in NAV at all.
  • Options
    matttraxmatttrax Member Posts: 2,309
    MBerger wrote:
    to be honest, personally i wouldn't put animations in NAV at all.

    Agreed.
  • Options
    vijay_gvijay_g Member Posts: 884
    :lol:
  • Options
    gpriyagpriya Member Posts: 17
    Hi,
    Thanks for your replies. I tried Currform.Update & Currform.Updatecontrols inside the loop. But it is not working in this case.


    Regards,
    Priya
  • Options
    thmartinthmartin Member Posts: 90
    Have a look at this real live example :D

    http://www.mibuso.com/dlinfo.asp?FileID=424
    Thomas Martin
    NAV Developer
Sign In or Register to comment.