eumandy/eugtk/examples/test69.ex
2016-11-25 00:33:18 -07:00

56 lines
1.7 KiB
Elixir

----------------------------------------------------------------
--# GtkEntry used for password entry
----------------------------------------------------------------
include GtkEngine.e
constant win = create(GtkWindow,
"size=300x100,border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant img = create(GtkImage,"thumbnails/dialog-password.png")
add(panel,img)
constant lbl1 = create(GtkLabel,"Authorized Personnel Only")
add(panel,lbl1)
constant pass = {254,9,79,120,120,75,106,123,75,106,131}
constant input = create(GtkEntry,{
{"max length",9},
{"visibility",FALSE}, -- use as password entry
{"icon from stock",0,"gtk-caps-lock-warning"},
{"tooltip markup",
format(`Hint: Password is <b><i>[1]</i></b>
<small>(shhh! don't tell!)</small>`,deserialize(pass))}})
connect(input,"changed",_("InputChanged"))
add(panel,input)
show_all(win)
main()
-------------------------------------------------------------------
function InputChanged()
-------------------------------------------------------------------
set(input,"progress fraction",get(input,"text length")* 0.10)
sequence pw = deserialize(pass)
if equal(pw[1],get(input,"text")) then
set(img,"from file","thumbnails/passgrn.png")
set(input,{
{"icon from stock",1,"gtk-media-play"},
{"icon activatable",1,TRUE},
{"connect","icon-press",_("PassOK")}})
end if
return 1
end function
------------------------------------------------------------------------
function PassOK()
------------------------------------------------------------------------
Info(0,"OK","Thanks","Your password was correct!")
return 1
end function