Popup

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 2 Imported by: 0

README

Popup

Create Windows Popup simple UI in Go

Installation

go get github.com/ChromeTemp/Popup

Usage

package main

import (
    "github.com/ChromeTemp/Popup"
    "fmt"
)

main() {
    // shows a native Windows alert
    Popup.Alert("Example Title", "Example Content")
    // shows a native Windows dialog (and handle user action)
    res := Popup.Dialog("Dialog", "Want to continue?")
    // Example: user will press Ok
    fmt.Println("Pressed Ok? "+res)
    // logs: Pressed Ok? true
}

Documentation

Index

Constants

View Source
const (
	MB_OK          = 0x00000000
	MB_OKCANCEL    = 0x00000001
	MB_YESNO       = 0x00000004
	MB_YESNOCANCEL = 0x00000003
	// this allows to focus the created popup instead another window
	MB_SYSTEMMODAL = 0x00001000
)
View Source
const (
	IDCANCEL = 2
	IDYES    = 6
	IDNO     = 7
)

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxw#return-value

Variables

This section is empty.

Functions

func Alert

func Alert(title string, message string)

Create an alert with title and message. Closes it with close button or Ok press. Returns void.

func Dialog

func Dialog(title string, message string) bool

Create a dialog that closes choosing Ok or No, returns true if Ok and false if No. Can't be closed via close button.

func LazyAlert added in v1.2.0

func LazyAlert(title string, message string)

Create a "lazy" alert (without default focus) with title and message. Closes it with close button or Ok press. Returns void.

func LazyDialog added in v1.1.0

func LazyDialog(title string, message string) bool

Create a "lazy" dialog (without default focus) that closes choosing Ok or No, returns true if Ok and false if No. Can't be closed via close button.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL