[REBOL] Re: Inform & keyboard
From: philb:upnaway at: 11-Jul-2002 0:56
Hi Scott/Volker,
Based on Volkers example I tried this .... no as nice as RT's request
(the size of the text field is hard coded for example)
but does the job I need ....
rebol [title: "OK Cancel Dialog box with keboard shortcuts"]
inform-kb: func [ip-text /local lay lv-ok] [
lay: layout [
space 5
origin 5x5
at 5x5
vtext ip-text bold 300x24
return
across
button "OK" #"^M" [lv-ok: true hide-popup]
button "Cancel" #"^[" [lv-ok: false hide-popup]
]
lay/feel: system/view/window-feel
inform lay [system/view/screen-face/size - lay/size / 2]
lv-ok
]
print inform-kb "This is a dialog box - Escape = Cancel Enter = OK"
halt
Cheers Phil
=== Original Message ===
Am Mittwoch, 10. Juli 2002 16:09 schrieb [philb--upnaway--com]:
> Hi Guys,
>
> I have a problem with Rebol & Dialog boxes.
>
> I want to put up a dialog box and press Escape to cancel it or Enter to
> confirm it.
>
> But it looks like inform isnt compatible with keyboard input.
> Sensors dont seem to work and keyboard shortcuts on buttons dont work
> either.
>
> Its not a showstopper but would make my program more user friendly.
>
> Any ideas .... or does anyone have some example for me to study?
>
hotkeys are evaluated in system/view/window-feel.
and that is set automatic by 'view only for the first window.
one can set it by hand. try:
lay: layout [
tf: title "press control-t" 400
button "test" #"^t" [
tf/text: "you pressed the button or the key"
show tf
]
]
lay/feel: system/view/window-feel
inform lay
> Cheers Phil
Cheers Volker