use tcl::*;
use tk::*;
use tk::cmd::*;
fn main() -> TkResult<()> {
let tk = make_tk!()?;
let root = tk.root();
#[proc] fn my_action() -> TkResult<()> { Ok(()) }
unsafe{ tk.def_proc( "myaction", my_action ); }
let button = root
.add_ttk_button( "action" -text("Action") -default_("active") -command("myaction") )?
.pack(())?;
root.bind(
event::key_press( TkKey::Return ),
tclosure!( tk, || -> InterpResult<Obj> { button.invoke() })
)?;
let b = root
.add_ttk_button( "b" -text("disabled?") -default_("active") -command("myaction") )?
.pack(())?;
b.set_state( TtkState::Disabled )?; b.set_state( !TtkState::Disabled )?; b.instate( TtkState::Disabled )?; b.instate( !TtkState::Disabled )?; b.instate_run( !TtkState::Disabled,
"myaction" )?;
Ok( main_loop() )
}