Mit dem &LastFocus scheint das wohl nicht ganz so zu sein, wie man denkt. Ich habe mir da jetzt einfach mal mit einem zusätzlichen Button in der Größe 0,0 beholfen.
Declare Int N, M, R, ST
Declare Handle myfont, id, edit1, edit2, edit3, t1, t2, t3, t4, t5, Button
myfont = @Create("Font", "Arial", 32, 16, 1, 0, 0)
WindowStyle $200 + 8
WindowTitle "Messwerte"
Window 1000, 300
t1 = @Create("Text", %HWnd, "ST :", 10, 100, 80, 40)
edit1 = @Create("Edit", %HWnd, "", 100, 100, 140, 40)
t2 = @Create("Text", %HWnd, "M :", 260, 100, 80, 40)
edit2 = @Create("Edit", %HWnd, "", 370, 100, 140, 40)
t3 = @Create("Text", %HWnd, "R :", 520, 100, 80, 40)
edit3 = @Create("Edit", %HWnd, "", 600, 100, 140, 40)
t4 = @Create("Text", %HWnd, "N :", 750, 100, 80, 40)
t5 = @Create("Text", %HWnd, "", 840, 100, 140, 40)
Button= @Create("Button", %HWnd, "", 0, 0, 0, 0)
SetFont edit1, myfont
SetFont t1, myfont
SetFont edit2, myfont
SetFont t2, myfont
SetFont edit3, myfont
SetFont t3, myfont
SetFont t4, myfont
SetFont t5, myfont
WhileNot (%Key = 2)
WaitInput
If (%Getfocus = Button)
N= @Val(GetText$(edit2)) - (@Val(GetText$(edit1)) - @Val(GetText$(edit3)))
SetText t5, Str$(N)
EndIf
Wend
End
Alles anzeigen
Damit funktioniert es, wie es soll. Ob das nun optimal ist 