Creates a dialog with a specified title.

Usage #

Let’s create a dialog with title “This is a test” and print out the result.

package main

import (
    "fmt"
    t "github.com/hugmouse/gotermux"
)

func main() {
    result := t.TermuxDialog("This is a test")
    fmt.Printf("%+v", result)
}
Output: {Code:-1 Text:This is my answer Index:0 Values:[] Error:}

Struct #

Code descriptions:

  • Code status -1 means user pressed “OK” in a dialog window
  • Code status -2 means user pressed “CANCEL”, pressed ESC or tapped out of the dialog window

Function returns TResult:

FieldTypeDescription
Codeint8-2, -1 or 0, error code description depends on the function
TextstringText that user wrote into a message dialog
IndexuintDialog window index
Values[]TValueUnused for TermuxDialog
ErrorstringUnused for TermuxDialog

Termux API reference #