0

I have an event - onClickButton where is only one line:

Button1.Caption:="ABC";

it isn't working ok - No effect after clicking on the button. When I insert another new line, for instance:

if x=10 then exit; //x=0 and exit doesn't invoke;
Button1.Caption:="ABC";

It works (caption on the button changed).

Any recompilation, building doesn't work. I other time or on other computer it works in both situations.

What can I do to avoid this problem?

Kromster
  • 7,181
  • 7
  • 63
  • 111
Artik
  • 803
  • 14
  • 36
  • 2
    What you're describing would be a blocking issue, which would never allow the compiler to be released to public. In other words, this must work. You must have a mistake in your code somewhere. Use debugger to see the real value of the `x` variable. Also always try to post the real code, not just fake pieces. – TLama Feb 28 '13 at 14:23
  • I don't have possibility take real unit code (I can not access at the moment to computer with presented problem) but It looks like I presented. The problem is not in line with "exit" - In this can be different code line - without corelation with button1.caption (I tried several) and only if one line was before line Button.Caption:='ABC" the last one worked ok. This unit (for Form) was simple - only with this events procedure - nothing else. – Artik Feb 28 '13 at 15:04
  • Ones I hade problem with similar events procedure where were two local variables a and b. I have assigned values a=1 and b=2 and multiply p=a*b; When I use debugger I saw p=2 but when put it to edit.text=inttostr(p) - there was 1. I copy the same project to other computer - it was working ok. Therefore I don't understand where is problem. Thank you for your patience. – Artik Feb 28 '13 at 15:06
  • Maybe you missed something `if x=10 then exit; //x=0 and exit doesn't invoke;` It sounds as the correct behavior: code says x=10 and comment says x=0 – Daniel Mar 27 '13 at 19:03

1 Answers1

0

Sometimes system didn't notice thaht something has chanhed and should be repainted. Have your tried calling refresh, repaint or update method on button or on whole application? There is nice explanation of this methods: What's the difference between Refresh, Update and Repaint?

Community
  • 1
  • 1
cezar
  • 587
  • 3
  • 10