QB64 Team Software > InForm-based programs

EBAC Calculator

(1/2) > >>

George McGinn:
This is a rework of a post I made a few months ago.

I converted my EBAC Calculator from Zenity to now use InForm, and uses many of it's features.

I've included all the files needed to compile it, and have tested it on Linux and MAC OSX. It should also run on Windows (I don't have a Windows OS installed).

Below is the main program for those who want to look at it, but you will need the files/directories in the .ZIP file if you want to compile it. You do not need InForm to compile and use the program. Just the files provided.

Here's the main source:

--- Code: QB64: ---REM $TITLE: ebacCalculator.bas Version 1.0  04/01/2021 - Last Update: 10/14/2021_TITLE "ebacCalculator.bas"' ebacCalculator.bas    Version 2.0  10/14/2021'-----------------------------------------------------------------------------------'       PROGRAM: ebacCalculator.bas'        AUTHOR: George McGinn''  DATE WRITTEN: 04/01/2021'       VERSION: 2.0'       PROJECT: Estimated Blood-Alcohol Content Calculator''   DESCRIPTION: Program shows many of the functions of using InForm while using'                most of the original code from the Zenity project. This can now'                run on all systems (Linux, MAC and Windows).'' Written by George McGinn' Copyright (C)2021 by George McGinn - All Rights Reserved' Version 1.0 - Created 04/01/2021' Version 2.0 - Created 10/14/2021'' CHANGE LOG'-----------------------------------------------------------------------------------' 04/01/2021 v1.0  GJM - New Program (TechBASIC and C++ Versions).' 06/19/2021 v1.5  GJM - Updated to use Zenity and SHELL commands to run on Linux with'                        a simple GUI.' 10/14/2021 v2.0  GJM - Updated to use InForm GUI in place of Zenity an SHELL commands.'                        Can now run on any OS'-----------------------------------------------------------------------------------'  Copyright (C)2021 by George McGinn.  All Rights Reserved.'' untitled.bas by George McGinn is licensed under a Creative Commons' Attribution-NonCommercial 4.0 International. (CC BY-NC 4.0)'' Full License Link: https://creativecommons.org/licenses/by-nc/4.0/legalcode''-----------------------------------------------------------------------------------' PROGRAM NOTES'': This program uses': InForm - GUI library for QB64 - v1.3': Fellippe Heitor, 2016-2021 - fellippe@qb64.org - [member=2]FellippeHeitor[/member]': https://github.com/FellippeHeitor/InForm'----------------------------------------------------------------------------------- ': Controls' IDs: ------------------------------------------------------------------DIM SHARED maleRB AS LONGDIM SHARED femaleRB AS LONGDIM SHARED AgreeCB AS LONGDIM SHARED AGREEBT AS LONGDIM SHARED ebacFRM AS LONGDIM SHARED SexLB AS LONGDIM SHARED weightLB AS LONGDIM SHARED nbrdrinksLB AS LONGDIM SHARED timeLB AS LONGDIM SHARED EnterInformationLB AS LONGDIM SHARED WeightTB AS LONGDIM SHARED nbrDrinksTB AS LONGDIM SHARED TimeTB AS LONGDIM SHARED CancelBT AS LONGDIM SHARED OKBT AS LONGDIM SHARED HELPBT AS LONGDIM SHARED QUITBT AS LONGDIM SHARED displayResults AS LONGDIM SHARED informationLB AS LONG ': User-defined Variables: ---------------------------------------------------------DIM SHARED AS STRING HELPFileDIM SHARED AS INTEGER l, SOBER, legalToDriveDIM SHARED AS STRING SexDIM SHARED AS DOUBLE A, TDIM SHARED AS SINGLE B, OZ, Wt, EBACDIM SHARED numeric(255) DIM SHARED AS STRING helpcontents, prt_text   ': External modules: ---------------------------------------------------------------'$INCLUDE:'InForm/InForm.bi''$INCLUDE:'InForm/xp.uitheme''$INCLUDE:'ebacCalculator.frm'   ': Event procedures: ---------------------------------------------------------------SUB __UI_BeforeInit END SUB SUB __UI_OnLoad ' *** Initialize Variables    A = 0    Wt = 0    B = .0    T = 0: St = 0    I = 0    Bdl = 1.055    OZ = .5    SOBER = False: legalToDrive = False    HELPFile = "EBACHelp.txt"    displayDisclaimer END SUB SUB __UI_BeforeUpdateDisplay    'This event occurs at approximately 60 frames per second.    'You can change the update frequency by calling SetFrameRate DesiredRate% END SUB SUB __UI_BeforeUnload    'If you set __UI_UnloadSignal = False here you can    'cancel the user's request to close. END SUB SUB __UI_Click (id AS LONG)    SELECT CASE id        CASE maleRB            Sex = "M"         CASE femaleRB            Sex = "F"         CASE AGREEBT            Answer = MessageBox("Do you want to perform another calculation?             ", "", MsgBox_YesNo + MsgBox_Question)            IF Answer = MsgBox_Yes THEN                Control(AgreeCB).Value = False                Control(AGREEBT).Disabled = True            ELSE                Answer = MessageBox("Thank You for using EBAC Calculator. Please Don't Drink and Drive.", "", MsgBox_Ok + MsgBox_Information)               SYSTEM            END IF         CASE CancelBT            ResetForm         CASE OKBT            IF Control(maleRB).Value = False AND Control(femaleRB).Value = False THEN                Answer = MessageBox("Invalid: You must select either M (male) or F (female). Please Correct.", "", MsgBox_Ok + MsgBox_Information)                EXIT SUB            END IF            A = Control(nbrDrinksTB).Value            Wt = Control(WeightTB).Value            T = Control(TimeTB).Value            calcEBAC            Control(QUITBT).Disabled = True            ResetList displayResults            Text(displayResults) = prt_text         CASE HELPBT            ResetList displayResults            IF _FILEEXISTS(HELPFile) THEN                DIM fh AS LONG                fh = FREEFILE                OPEN HELPFile FOR INPUT AS #fh                DO UNTIL EOF(fh)                    LINE INPUT #fh, helpcontents                    AddItem displayResults, helpcontents                LOOP                CLOSE #fh                Control(displayResults).LastVisibleItem = 0            ELSE                Answer = MessageBox("HELP File " + HELPFile$ + " Not Found                             ", "", MsgBox_Ok + MsgBox_Question)                SYSTEM 1            END IF         CASE QUITBT            Answer = MessageBox("Are you sure you want to QUIT?                     ", "", MsgBox_YesNo + MsgBox_Question)            IF Answer = MsgBox_Yes THEN                Answer = MessageBox("Thank You for using EBAC Calculator. Please Don't Drink and Drive.", "", MsgBox_Ok + MsgBox_Information)                SYSTEM            END IF     END SELECTEND SUB SUB __UI_MouseEnter (id AS LONG)END SUB SUB __UI_MouseLeave (id AS LONG)END SUB SUB __UI_FocusIn (id AS LONG)END SUB SUB __UI_FocusOut (id AS LONG)    'This event occurs right before a control loses focus.    'To prevent a control from losing focus, set __UI_KeepFocus = True below.END SUB SUB __UI_MouseDown (id AS LONG)END SUB SUB __UI_MouseUp (id AS LONG)END SUB SUB __UI_KeyPress (id AS LONG)    'When this event is fired, __UI_KeyHit will contain the code of the key hit.    'You can change it and even cancel it by making it = 0END SUB SUB __UI_TextChanged (id AS LONG)    SELECT CASE id         CASE WeightTB            Control(AgreeCB).Value = False            Control(AGREEBT).Disabled = True         CASE nbrDrinksTB            Control(AgreeCB).Value = False            Control(AGREEBT).Disabled = True         CASE TimeTB            Control(AgreeCB).Value = False            Control(AGREEBT).Disabled = True     END SELECTEND SUB SUB __UI_ValueChanged (id AS LONG)    SELECT CASE id         CASE maleRB            Control(AgreeCB).Value = False            Control(AGREEBT).Disabled = True         CASE femaleRB            Control(AgreeCB).Value = False            Control(AGREEBT).Disabled = True         CASE AgreeCB            IF Control(AgreeCB).Value = True THEN                Control(AGREEBT).Disabled = False                Control(QUITBT).Disabled = False            ELSE                Control(AGREEBT).Disabled = True                Control(QUITBT).Disabled = True            END IF     END SELECTEND SUB SUB __UI_FormResizedEND SUB '$INCLUDE:'InForm/InForm.ui'  ': User FUNCTIONS/SUBROUTINES: --------------------------------------------------------------- SUB displayDisclaimer '    prt_text = "*** DISCLAIMER ***" + CHR$(10)    prt_text = "Unless otherwise separately undertaken by the Licensor, to the extent" + CHR$(10)    prt_text = prt_text + "possible, the Licensor offers the Licensed Material as-is and" + CHR$(10)    prt_text = prt_text + "as-available, and makes no representations or warranties of any kind" + CHR$(10)    prt_text = prt_text + "concerning the Licensed Material, whether express, implied, statutory," + CHR$(10)    prt_text = prt_text + "or other. This includes, without limitation, warranties of title," + CHR$(10)    prt_text = prt_text + "merchantability, fitness for a particular purpose, non-infringement," + CHR$(10)    prt_text = prt_text + "absence of latent or other defects, accuracy, or the presence or absence" + CHR$(10)    prt_text = prt_text + "of errors, whether or not known or discoverable. Where disclaimers of" + CHR$(10)    prt_text = prt_text + "warranties are not allowed in full or in part, this disclaimer may not" + CHR$(10)    prt_text = prt_text + "apply to You." + CHR$(10) + CHR$(10)     prt_text = prt_text + "To the extent possible, in no event will the Licensor be liable to You" + CHR$(10)    prt_text = prt_text + "on any legal theory (including, without limitation, negligence) or" + CHR$(10)    prt_text = prt_text + "otherwise for any direct, special, indirect, incidental, consequential," + CHR$(10)    prt_text = prt_text + "punitive, exemplary, or other losses, costs, expenses, or damages" + CHR$(10)    prt_text = prt_text + "arising out of this Public License or use of the Licensed Material, even" + CHR$(10)    prt_text = prt_text + "if the Licensor has been advised of the possibility of such losses," + CHR$(10)    prt_text = prt_text + "costs, expenses, or damages. Where a limitation of liability is not" + CHR$(10)    prt_text = prt_text + "allowed in full or in part, this limitation may not apply to You." + CHR$(10) + CHR$(10)     prt_text = prt_text + "The disclaimer of warranties and limitation of liability provided above" + CHR$(10)    prt_text = prt_text + "shall be interpreted in a manner that, to the extent possible, most" + CHR$(10)    prt_text = prt_text + "closely approximates an absolute disclaimer and waiver of all liability." + CHR$(10)     Answer = MessageBox(prt_text, "*** DISCLAIMER ***", MsgBox_YesNo + MsgBox_Question)    IF Answer = MsgBox_No THEN        Answer = MessageBox("Sorry you don't agree. Please Don't Drink and Drive.", "", MsgBox_Ok + MsgBox_Information)        SYSTEM    END IF END SUB  SUB ResetForm    Control(nbrDrinksTB).Value = 0    Control(WeightTB).Value = 0    Control(TimeTB).Value = 0    Control(AgreeCB).Value = False    Control(AGREEBT).Disabled = True    Control(maleRB).Value = False    Control(femaleRB).Value = False    ResetList displayResults    Sex = ""END SUB  SUB calcEBAC'-------------------------------------------------------------' *** Convert Drinks into Fluid Ounces of EtOH (Pure Alcohol).' *** A is number of drinks. 1 drink is about .6 FLoz of alcohol    FLoz = A * OZ    legalToDrive = False '-----------------------------------------------------' *** Set/calculate EBAC values based on Sex    SELECT CASE Sex        CASE "M"            B = .017            EBAC = 7.97 * FLoz / Wt - B * T        CASE "F"            B = .019            EBAC = 9.86 * FLoz / Wt - B * T    END SELECT     IF EBAC < 0 THEN EBAC = 0 '----------------------------------------------------------------------------------------------' *** Populate the EBAC string with the EBAC value formatted to 3 decimal places for FORM output    prt_text = "ESTIMATED BLOOD ALCOHOL CONTENT (EBAC) in g/dL = " + strFormat$(STR$(EBAC), "###.###") + CHR$(10) + CHR$(10)  '-----------------------------------------------------------------------------------------' *** Based on EBAC range values, populate the FORM output string with the approriate text    SELECT CASE EBAC        CASE .500 TO 100.9999            prt_text = prt_text + "*** ALERT: CALL AN AMBULANCE, DEATH LIKELY" + CHR$(10)            prt_text = prt_text + "Unconsious/coma, unresponsive, high likelihood of death. It is illegal" + CHR$(10) + _                                  "to operate a motor vehicle at this level of intoxication in all states." + CHR$(10)        CASE .400 TO .4999            prt_text = prt_text + "*** ALERT: CALL AN AMBULANCE, DEATH POSSIBLE" + CHR$(10)            prt_text = prt_text + "Onset of coma, and possible death due to respiratory arrest. It is illegal" + CHR$(10) + _                                  "to operate a motor vehicle at this level of intoxication in all states." + CHR$(10)        CASE .350 TO .3999            prt_text = prt_text + "*** ALERT: CALL AN AMBULANCE, SEVERE ALCOHOL POISONING" + CHR$(10)            prt_text = prt_text + " Coma is possible. This is the level of surgical anesthesia. It is illegal" + CHR$(10) + _                                  "to operate a motor vehicle at this level of intoxication in all states." + CHR$(10)        CASE .300 TO .3499            prt_text = prt_text + "*** ALERT: YOU ARE IN A DRUNKEN STUP0R, AT RISK TO PASSING OUT" + CHR$(10)            prt_text = prt_text + "STUPOR. You have little comprehension of where you are. You may pass out" + CHR$(10) + _                                  "suddenly and be difficult to awaken. It is illegal to operate a motor" + CHR$(10) + _                                  "vehicle at this level of intoxication in all states." + CHR$(10)        CASE .250 TO .2999            prt_text = prt_text + "*** ALERT: SEVERLY IMPAIRED - DRUNK ENOUGH TO CAUSE SEVERE INJURY/DEATH TO SELF" + CHR$(10)            prt_text = prt_text + "All mental, physical and sensory functions are severely impaired." + CHR$(10) + _                                  "Increased risk of asphyxiation from choking on vomit and of seriously injuring" + CHR$(10) + _                                  "yourself by falls or other accidents. It is illegal to operate a motor" + CHR$(10) + _                                  "vehicle at this level of intoxication in all states." + CHR$(10)        CASE .200 TO .2499            prt_text = prt_text + "YOU ARE EXTREMELY DRUNK" + CHR$(10)            prt_text = prt_text + "Feeling dazed/confused or otherwise disoriented. May need help to" + CHR$(10) + _                                  "stand/walk. If you injure yourself you may not feel the pain. Some" + CHR$(10) + _                                  "people have nausea and vomiting at this level. The gag reflex" + CHR$(10) + _                                  "is impaired and you can choke if you do vomit. Blackouts are likely" + CHR$(10) + _                                  "at this level so you may not remember what has happened. It is illegal" + CHR$(10) + _                                  "to operate a motor vehicle at this level of intoxication in all states." + CHR$(10)        CASE .160 TO .1999            prt_text = prt_text + "YOUR ARE SEVERLY DRUNK - ENOUGH TO BECOME VERY SICK" + CHR$(10)            prt_text = prt_text + "Dysphoria* predominates, nausea may appear. The drinker has the appearance" + CHR$(10) + _                                  "of a 'sloppy drunk.' It is illegal to operate a motor vehicle at this level" + CHR$(10) + _                                  "of intoxication in all states." + CHR$(10) + CHR$(10) + _                                  "* Dysphoria: An emotional state of anxiety, depression, or unease." + CHR$(10)        CASE .130 TO .1599            prt_text = prt_text + "YOU ARE VERY DRUNK - ENOUGH TO LOSE PHYSICAL & MENTAL CONTROL" + CHR$(10)            prt_text = prt_text + "Gross motor impairment and lack of physical control. Blurred vision and major" + CHR$(10) + _                                  "loss of balance. Euphoria is reduced and dysphoria* is beginning to appear." + CHR$(10) + _                                  "Judgment and perception are severely impaired. It is illegal to operate a " + CHR$(10) + _                                  "motor vehicle at this level of intoxication in all states." + CHR$(10) + CHR$(10)            prt_text = prt_text + "* Dysphoria: An emotional state of anxiety, depression, or unease." + CHR$(10)        CASE .100 TO .1299            prt_text = prt_text + "YOU ARE LEGALLY DRUNK" + CHR$(10)            prt_text = prt_text + "Significant impairment of motor coordination and loss of good judgment." + CHR$(10) + _                                  "Speech may be slurred; balance, vision, reaction time and hearing will be" + CHR$(10) + _                                  "impaired. Euphoria. It is illegal to operate a motor vehicle at this level" + CHR$(10) + _                                  "of intoxication in all states." + CHR$(10)        CASE .070 TO .0999            prt_text = prt_text + "YOU MAY BE LEGALLY DRUNK" + CHR$(10)            prt_text = prt_text + "Slight impairment of balance, speech, vision, reaction time, and hearing." + CHR$(10) + _                                  "Euphoria. Judgment and self-control are reduced, and caution, reason and" + CHR$(10) + _                                  "memory are impaired (in some* states .08 is legally impaired and it is illegal" + CHR$(10) + _                                  "to drive at this level). You will probably believe that you are functioning" + CHR$(10) + _                                  "better than you really are." + CHR$(10) + CHR$(10)            prt_text = prt_text + "(*** As of July, 2004 ALL states had passed .08 BAC Per Se Laws. The final" + CHR$(10) + _                                  "one took effect in August of 2005.)" + CHR$(10)        CASE .040 TO .0699            prt_text = prt_text + "YOU MAY BE LEGALLY BUZZED" + CHR$(10)            prt_text = prt_text + "Feeling of well-being, relaxation, lower inhibitions, sensation of warmth." + CHR$(10) + _                                  "Euphoria. Some minor impairment of reasoning and memory, lowering of caution." + CHR$(10) + _                                  "Your behavior may become exaggerated and emotions intensified (Good emotions" + CHR$(10) + _                                  "are better, bad emotions are worse)" + CHR$(10)        CASE .020 TO .0399            prt_text = prt_text + "YOU MAY BE OK TO DRIVE, BUT IMPAIRMENT BEGINS" + CHR$(10)            prt_text = prt_text + "No loss of coordination, slight euphoria and loss of shyness. Depressant effects" + CHR$(10) + _                                  "are not apparent. Mildly relaxed and maybe a little lightheaded." + CHR$(10)        CASE .000 TO .0199            prt_text = prt_text + "YOU ARE OK TO DRIVE" + CHR$(10)    END SELECT '-----------------------------------------------------------'*** Determine if Drunk (>.08 EBAC) and calculate:'***    - When user will be less than .08'***    - How long it will take to become completely sober    IF EBAC > .08 THEN        SOBER = False        CEBAC = EBAC        st = T        DO UNTIL SOBER = True            T = T + 1            IF CEBAC > .0799 THEN I = I + 1             SELECT CASE Sex                CASE "M"                    B = .017                    CEBAC = 7.97 * FLoz / Wt - B * T                CASE "F"                    B = .019                    CEBAC = 9.86 * FLoz / Wt - B * T            END SELECT             IF legalToDrive = False THEN                IF CEBAC < .08 THEN                    prt_text = prt_text + CHR$(10) + CHR$(10) + "It will take about " + strFormat$(STR$(I), "##") + " hours from your last drink to be able to drive." + CHR$(10)                    legalToDrive = True                END IF            END IF             IF CEBAC <= 0 THEN                prt_text = prt_text + "It will take about " + strFormat$(STR$(T - st), "##") + " hours from your last drink to be completely sober."                SOBER = True            END IF        LOOP    END IF END SUB  FUNCTION strFormat$ (text AS STRING, template AS STRING)'-----------------------------------------------------------------------------' *** Return a formatted string to a variable'    d = _DEST: s = _SOURCE    n = _NEWIMAGE(80, 80, 0)    _DEST n: _SOURCE n    PRINT USING template; VAL(text)    FOR i = 1 TO 79        t$ = t$ + CHR$(SCREEN(1, i))    NEXT    IF LEFT$(t$, 1) = "%" THEN t$ = MID$(t$, 2)    strFormat$ = _TRIM$(t$)    _DEST d: _SOURCE s    _FREEIMAGE nEND FUNCTION  
And the Form file:

--- Code: QB64: ---': This form was generated by': InForm - GUI library for QB64 - v1.3': Fellippe Heitor, 2016-2021 - fellippe@qb64.org - [member=2]FellippeHeitor[/member]': https://github.com/FellippeHeitor/InForm'-----------------------------------------------------------SUB __UI_LoadForm     DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG     __UI_NewID = __UI_NewControl(__UI_Type_Form, "ebacFRM", 618, 630, 0, 0, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "EBAC - ESTIMATED BLOOD ALCOHOL CONTENT CALCULATOR"    Control(__UI_NewID).Font = SetFont("Fonts/arial.ttf", 16)    Control(__UI_NewID).HasBorder = False     __UI_NewID = __UI_NewControl(__UI_Type_Label, "SexLB", 40, 26, 232, 64, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Sex:"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle     __UI_NewID = __UI_NewControl(__UI_Type_Label, "weightLB", 99, 25, 173, 91, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Weight (lbs):"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle     __UI_NewID = __UI_NewControl(__UI_Type_Label, "nbrdrinksLB", 138, 25, 134, 121, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Number of drinks:"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle     __UI_NewID = __UI_NewControl(__UI_Type_Label, "timeLB", 202, 25, 70, 151, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Time (hrs) from first drink:"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle     __UI_NewID = __UI_NewControl(__UI_Type_Label, "EnterInformationLB", 440, 31, 16, 17, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Enter information about your or your friend:"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 18)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle     __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "WeightTB", 50, 23, 278, 92, 0)    __UI_RegisterResult = 0    Control(__UI_NewID).Font = SetFont("", 16)    Control(__UI_NewID).HasBorder = True    Control(__UI_NewID).Min = -32768    Control(__UI_NewID).Max = 32767    Control(__UI_NewID).CanHaveFocus = True    Control(__UI_NewID).BorderSize = 1    Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds     __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "nbrDrinksTB", 50, 23, 278, 121, 0)    __UI_RegisterResult = 0    Control(__UI_NewID).Font = SetFont("", 16)    Control(__UI_NewID).HasBorder = True    Control(__UI_NewID).Min = -32768    Control(__UI_NewID).Max = 32767    Control(__UI_NewID).CanHaveFocus = True    Control(__UI_NewID).BorderSize = 1    Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds     __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "TimeTB", 50, 25, 277, 151, 0)    __UI_RegisterResult = 0    Control(__UI_NewID).Font = SetFont("", 16)    Control(__UI_NewID).HasBorder = True    Control(__UI_NewID).Min = -32768    Control(__UI_NewID).Max = 32767    Control(__UI_NewID).CanHaveFocus = True    Control(__UI_NewID).BorderSize = 1    Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds     __UI_NewID = __UI_NewControl(__UI_Type_Button, "CancelBT", 99, 30, 435, 99, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "&Cancel"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_Button, "OKBT", 99, 30, 435, 63, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "&OK"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_Button, "HELPBT", 99, 30, 435, 134, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "&HELP"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_Button, "QUITBT", 99, 30, 435, 170, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "&QUIT"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_Label, "informationLB", 210, 17, 22, 194, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "Information Display"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).VAlign = __UI_Middle    Control(__UI_NewID).BorderSize = 1     __UI_NewID = __UI_NewControl(__UI_Type_ListBox, "displayResults", 576, 320, 20, 213, 0)    __UI_RegisterResult = 0    Control(__UI_NewID).Font = SetFont("Fonts/Courier New.ttf", 12)    Control(__UI_NewID).HasBorder = True    Control(__UI_NewID).CanHaveFocus = True    Control(__UI_NewID).BorderSize = 2     __UI_NewID = __UI_NewControl(__UI_Type_Button, "AGREEBT", 99, 31, 495, 574, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "&AGREE"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True    Control(__UI_NewID).Disabled = True     __UI_NewID = __UI_NewControl(__UI_Type_CheckBox, "AgreeCB", 564, 23, 26, 544, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "I agree that this programand its results are not legally binding."    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "maleRB", 40, 23, 277, 64, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "M"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True     __UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "femaleRB", 40, 23, 322, 64, 0)    __UI_RegisterResult = 0    SetCaption __UI_NewID, "F"    Control(__UI_NewID).Font = SetFont("Fonts/Arial Black.ttf", 14)    Control(__UI_NewID).HasBorder = False    Control(__UI_NewID).CanHaveFocus = True END SUB SUB __UI_AssignIDs    ebacFRM = __UI_GetID("ebacFRM")    SexLB = __UI_GetID("SexLB")    weightLB = __UI_GetID("weightLB")    nbrdrinksLB = __UI_GetID("nbrdrinksLB")    timeLB = __UI_GetID("timeLB")    EnterInformationLB = __UI_GetID("EnterInformationLB")    WeightTB = __UI_GetID("WeightTB")    nbrDrinksTB = __UI_GetID("nbrDrinksTB")    TimeTB = __UI_GetID("TimeTB")    CancelBT = __UI_GetID("CancelBT")    OKBT = __UI_GetID("OKBT")    HELPBT = __UI_GetID("HELPBT")    QUITBT = __UI_GetID("QUITBT")    informationLB = __UI_GetID("informationLB")    displayResults = __UI_GetID("displayResults")    AGREEBT = __UI_GetID("AGREEBT")    AgreeCB = __UI_GetID("AgreeCB")    maleRB = __UI_GetID("maleRB")    femaleRB = __UI_GetID("femaleRB")END SUB 
Here is the complete ZIP file, that contains all the source, fonts, and text files needed to run the program:  ebacCalculator.zip

FellippeHeitor:
Great adaptation, George - precisely the kind of app that benefits from InForm, due to the type of input. Thanks for sharing!

Pete:
Interesting. A program that merits both cheers and booze.

Pete

George McGinn:
I'll drink to that!  Cheers!


--- Quote from: Pete on October 14, 2021, 05:14:45 pm ---Interesting. A program that merits both cheers and booze.

Pete

--- End quote ---

Qwerkey:
Great to have a member writing InForm programs.

Very small point: your form has a typo: "I agree that this programand its results are not legally binding." Space missing after 'program'.

Richard

Navigation

[0] Message Index

[#] Next page

Go to full version