Greetings everyone,
I made my first program with BlitzPlus, but there seems to be an error which I can't solve. I'm trying to create a little converter between celsius and fahrenheit, but adding the result to a textbox doesn't seem to work. Can someone tell me what I am doing wrong? This is the code:
;*******************************
; Nick's Convert0r
;*******************************
; By: Armor Nick
; Date: 2007-06-09
;*******************************
; Main Window Initialization
frmMain = CreateWindow("Nick's Convert0r",0,0,602,444,0,1)
txtInput = CreateTextField(105, 23, 356, 21, frmMain)
btnF2C = CreateButton("Fahrenheit to Celcius",105, 72,357, 23,frmMain)
btnC2F = CreateButton("Celcius to Fahrenheit",105, 118,357, 23,frmMain)
btnAbout = CreateButton("About",12, 375,75, 23,frmMain)
txtOutput = CreateTextArea(105, 160,354, 210,frmMain)
; Main Window Loop
Repeat
If WaitEvent()=$401 Then
If EventSource()=btnF2C Then ConvertF2C(TextFieldText$(txtInput))
If EventSource()=btnC2F Then ConvertC2F(TextFieldText$(txtInput))
If EventSource()=btnAbout Then ShowAbout()
End If
If WaitEvent()=$803 Then
Exit
End If
Forever
End
; Fahrenheit to Celcius conversion
Function ConvertF2C( msg$ )
degrF# = msg$
degrC# = (5.0/9.0)*(degrF#-32.0)
output = Str degrC#
AddTextAreaText txtOutput, output
End Function
;Celcius to Fahrenheit conversion
Function ConvertC2F( msg$ )
degrC# = msg$
degrF# = 32.0 + (9.0/5.0) * degrC#
output = Str degrF#
AddTextAreaText txtOutput, Str degrF#
End Function
Function ShowAbout()
Notify "Test Program by Armor Nick"
End Function
|