WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Convert Temperatures

 Keywords:  Convert Temperatures Fahrenheit Celcius

; TEMPERATURE-CONVERTER.WBT
; Developer: Garry J. Nichol (NTP)
flag1=0
#DefineSubRoutine MyDialogCode(dlghandle,dlgmessage,dlgID,reserved4,reserved5)

         ;Define a few handy constants here
         setflag=1
         MSG_Initialization=0

         Switch dlgmessage

             Case 0  ; The Dialog Initialization call
                DialogProcOptions(dlghandle,2,@TRUE)
                Break

             Case 2
                Switch dlgID

                  Case 001  ;;; FARENHIET TO CELCIUS
                      cbval3=DialogControlGet(dlghandle,004,3)
                      cbval3=StrTrim(cbval3)
                      flag1=IsFloat(cbval3)
                      If flag1==1
                           cbval3=(5.0 /  9.0) * (cbval3 - 32)
                           cbval3=StrSub(cbval3, 1, 6)
                           cbval3=StrCat(cbval3, " C")
                           DialogControlSet(dlghandle,003,4,cbval3)
                          flag1=0
                      Else
                          Message("Not a valid number ....)", "Please re-enter your numbe.r")
                      EndIf
                  Break

                  Case 002  ;;; EXIT
                      Exit
                  Break

                  Case 006 ;;; CELCIUS TO FARENHIET
                      cbval3=DialogControlGet(dlghandle,005,3)
                      cbval3=StrTrim(cbval3)
                      flag1=IsFloat(cbval3)
                      If flag1==1
                          cbval3=((9.0 /  5.0) * cbval3) + 32
                          cbval3=StrSub(cbval3, 1, 6)
                          cbval3=StrCat(cbval3, " F")
                          DialogControlSet(dlghandle,003,4,cbval3)
                          flag1=0
                      Else
                          Message("Not a valid number ....)", "Please re-enter your numbe.r")
                      EndIf
                  Break

                 EndSwitch  ; of dlgID
                 Break

         EndSwitch  ; of dlgmessage

         Return (-2) ; -1 for off after pushbutton, -2 stay on

#EndFunction
MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`NTP TEMP. CONVERTER`
MyDialogX=400
MyDialogY=350
MyDialogWidth=128
MyDialogHeight=126
MyDialogNumControls=009
MyDialogProcedure=`MYDIALOGCODE`
MyDialogFont=`Arial|6554|40|34`
MyDialogTextColor=`255|255|0`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`010,046,040,009,PUSHBUTTON,DEFAULT,"F to C",1,1,32,"Arial|6554|70|34","255|255|255","0|187|0"`
MyDialog002=`042,098,042,011,PUSHBUTTON,DEFAULT,"EXIT",0,2,DEFAULT,"Arial|9421|70|34","255|255|255","255|0|0"`
MyDialog003=`012,063,094,022,VARYTEXT,RESULT1,"RESULT",DEFAULT,3,512,"Arial|19251|70|34","255|255|0",DEFAULT`
MyDialog004=`010,023,040,013,EDITBOX,FARENHIET,"32",DEFAULT,4,0,"Arial|9421|70|34","0|0|0",DEFAULT`
MyDialog005=`076,023,040,013,EDITBOX,CELCIUS,"100",DEFAULT,5,DEFAULT,"Arial|9421|70|34","0|0|0",DEFAULT`
MyDialog006=`076,046,040,009,PUSHBUTTON,DEFAULT,"C to F",2,1,0,"Arial|6554|70|34","255|255|255","0|187|0"`
MyDialog007=`006,006,113,009,STATICTEXT,DEFAULT,"F<>C CONVERTER",DEFAULT,7,512,"Microsoft Sans Serif|6554|70|34","255|255|255",DEFAULT`
MyDialog008=`007,017,046,007,STATICTEXT,DEFAULT,"ENTER F",DEFAULT,8,512,"Arial|6554|70|34","255|255|0",DEFAULT`
MyDialog009=`073,017,046,007,STATICTEXT,DEFAULT,"ENTER C",DEFAULT,8,512,"Arial|6554|70|34","255|255|0",DEFAULT`

ButtonPushed=Dialog("MyDialog")

Article ID:   W17915
Filename:   Convert Temperatures.txt
File Created: 2011:07:20:14:30:08
Last Updated: 2011:07:20:14:30:08