Console Multi_prompt Input
#5
(07-07-2023, 02:17 PM)James D Jarvis Wrote: I just wanted a simple programming method that was cross platform because it didn't require any  API calls or even shell commands that may have been system specific, and it's also comprehensible to beginners.

Here I have shown 4 alternate methods not specifically intended for console.
https://staging.qb64phoenix.com/showthre...8#pid17118

This is pretty simple and should work on console:
Code: (Select All)
_Title "Multiple Input Menu demo" 'b+ 2021-06-11

Type InputItem
    As String promptName, SValue
End Type

ReDim Shared nItems
nItems = 12 ' number of inputs plus 2 for quit and goto for processing inputs

' initial item names (like variables)
ReDim inps(1 To nItems) As InputItem
For i = 1 To nItems - 2
    inps(i).promptName = "Demo Input Item #" + _Trim$(Str$(i))
Next
inps(nItems - 1).promptName = "Process Inputs"
inps(nItems).promptName = "Quit"
Do
    Cls
    For i = 1 To nItems
        Print "#" + _Trim$(Str$(i)), inps(i).promptName;
        If inps(i).SValue <> "" Then Print " = "; inps(i).SValue Else Print
    Next
    Print: Input "Enter choice # "; choice
    If choice < nItems - 1 Then
        Print "Please enter, " + inps(choice).promptName + " ";
        Input inps(choice).SValue
    End If
Loop Until choice >= nItems - 1 And choice <= nItems
Select Case choice
    Case nItems: Print "You quit, goodbye!": End
    Case nItems - 1
        ' <<< could check inputs here and handle errors
        GoTo processInputs
End Select

processInputs:
' doit  remember SValues are strings!
Print "Processing Inputs now..."

This allows user to edit their inputs by menu numbers until they press enter at last input item (enters on others just prompt next input item).
This is like for filling out a form without having to design a form.
b = b + ...
Reply


Messages In This Thread
Console Multi_prompt Input - by James D Jarvis - 06-20-2023, 02:21 PM
RE: Console Multi_prompt Input - by mnrvovrfc - 07-07-2023, 01:58 AM
RE: Console Multi_prompt Input - by Ultraman - 07-07-2023, 12:26 PM
RE: Console Multi_prompt Input - by bplus - 07-07-2023, 03:27 PM



Users browsing this thread: 5 Guest(s)