Files
kryon/examples/16_dialogs.kry
T
2026-08-09 19:52:01 -03:00

40 lines
1.1 KiB
Plaintext

#import "kryon.h"
app "Kryon Dialogs" {
size 800 600
fps 60
font examples
theme THEME_SKY light
}
state {
dialog: int = 0
prompt: [128] char = "value"
cursor: int = 5
focused: int = 0
color: Color = {120,160,220,255}
}
screen DialogsExample(viewport: Rectangle) {
Background(GetThemeBackground())
if GenericButton(101, 40, 60, 150, 34, "Message", UI_BUTTON_STYLE_PRIMARY, 0, NULL) {
dialog = 1
}
if GenericButton(102, 40, 104, 150, 34, "Confirm", UI_BUTTON_STYLE_PRIMARY, 0, NULL) {
dialog = 2
}
if GenericButton(103, 40, 148, 150, 34, "Prompt", UI_BUTTON_STYLE_PRIMARY, 0, NULL) {
dialog = 3
}
ColorPicker((Rectangle){240,60,320,160},&color)
if dialog == 1 && MessageDialog((MessageDialogProps){"Message","Hello from Kryon.","OK"}) > 0 {
dialog = 0
}
if dialog == 2 && ConfirmDialog((ConfirmDialogProps){"Confirm","Continue?","No","Yes"}) != 0 {
dialog = 0
}
if dialog == 3 && PromptDialog((PromptDialogProps){"Prompt",prompt,sizeof(prompt),&cursor,&focused,"Cancel","Save"}) != 0 {
dialog = 0
}
}