JBtemp

=**JBTemp v1.0 **=

JBTemp is a simple temperature conversion program. I started on it a few years ago and am reworking it after taking a long break. Spending time now to re-learn some programming concepts.

The specific goals I have in mind for this version are:
 * 1) Be able to input data into a text box
 * 2) Perform math calculations on button click
 * 3) Output data into a text box
 * 4) Only accept numbers in the text box
 * 5) Clear characters out of text boxes
 * 6) And... good GUI design

code format="lb" ' JBTemp *** version 1.0 ' ' Program Created with Just BASIC v1.01 ' Form Created with Freeform-J v1.0a for Just BASIC ' Date Created: 5/22/2017 ' By: Joe Cole (AKA - thejoecole) ' ' Temperature conversion program for converting between Fahrenheit and Celsius '***************************************************************************************** nomainwin

WindowWidth = 520 WindowHeight = 349 UpperLeftX=INT((DisplayWidth-WindowWidth)/2) UpperLeftY=INT((DisplayHeight-WindowHeight)/2)

statictext #main.statictext1, "Simple Temperature Converstion Program", 135, 15, 255, 20 groupbox #main.groupbox2, "Fahrenheit to Celsius", 60, 50, 395, 90 groupbox #main.groupbox3, "Celsius to Fahrenheit", 60, 160, 395, 90 button #main.button4, "CONVERT", [button4Click], UL, 220, 80, 80, 30 button #main.button5, "CONVERT", [button5Click], UL, 220, 195, 80, 30 button #main.button6, "CLEAR", [button6Click], UL, 165, 270, 80, 30 button #main.button7, "EXIT", [button7Click], UL, 275, 270, 80, 30 textbox #main.textbox8, 100, 80, 80, 30 textbox #main.textbox9, 325, 80, 80, 30 textbox #main.textbox10, 100, 195, 80, 30 textbox #main.textbox11, 325, 195, 80, 30 statictext #main.statictext12, "°F", 185, 85, 15, 20 statictext #main.statictext13, "°C", 410, 85, 15, 20 statictext #main.statictext14, "°C", 185, 200, 15, 20 statictext #main.statictext15, "°F", 410, 200, 15, 20 open "JBTemp v1.0" for Window as #main print #main, "trapclose [quit]" print #main, "font arial 10"

[main.inputLoop]  'wait here for input event wait

[quit] close #main :END

[button4Click]  'Convert Fahrenheit to Celsius print #main.textbox8, "!contents? F$" F = Val(F$) if F$ <> "0" and F=0 then notice "You must enter a number for the temperature!" end if   print #main.textbox9, (5/9)*(F-32) wait

[button5Click]  'Convert Celsius to Fahrenheit print #main.textbox10, "!contents? C$" C = Val(C$) if C$ <> "0" and C=0 then notice "You must enter a number for the temperature!" end if   print #main.textbox11, (9/5)* C+32 wait

[button6Click]  'Clear All Text Boxes print #main.textbox8, "" print #main.textbox9, "" print #main.textbox10, "" print #main.textbox11, "" wait

[button7Click]  'Close Program close #main wait

code

Feel free to comment, critique or just say hello. :) 