How to capture Frame Events w/o Enabled Widgets?

gummbeey

New Member
How do I capture events of a frame that contains no enabled widgets?

My messagebox pops up in GUI only after I click the frame with my mouse. But this code is really for Character version, so no mouse is involved.

I'm guessing I need to somehow get the focus on the frame but I tried many ways and failed.

Code:
[FONT=Courier New]def var c as char init "hello".[/FONT]
 
[FONT=Courier New]def frame f [/FONT]
[FONT=Courier New]c[/FONT]
[FONT=Courier New]with overlay no-labels col 1 row 2 size 10 by 10.[/FONT]
 
[FONT=Courier New]on "f5" of frame f anywhere[/FONT]
[FONT=Courier New]do:[/FONT]
[FONT=Courier New]message "f5 " view-as alert-box.[/FONT]
[FONT=Courier New]end.[/FONT]
 
 
[FONT=Courier New]view frame f.[/FONT]
 
[FONT=Courier New]disp c with frame f.[/FONT]
 
[FONT=Courier New]apply "entry" to frame f. /* <-- does not work */[/FONT]
[FONT=Courier New]apply "focus" to frame f. /* <-- does not work */[/FONT]
[FONT=Courier New]focus = frame f:handle. /* <-- does not work */[/FONT]
 
[FONT=Courier New]wait-for close of this-procedure focus frame f. /* <-- does not work */[/FONT]
 

joey.jeremiah

ProgressTalk Moderator
Staff member
/* in chui there is only a single window widget for the entire screen */

on "f5" of default-window anywhere do:

message

"Hello World"

view-as alert-box.

end. /* f5 of default-window */



define frame a with size 10 by 4.

assign

/* center frame */

frame a:column = ( default-window:width - frame a:width ) / 2 + 1
frame a:row = ( default-window:height - frame a:height ) / 2 + 1.

view frame a.

enable with frame a. /* enable / sensitive */



/* for a widget to receive events it has to be sensitive !

* the session default-window is sensitive */

wait-for "window-close" of current-window

focus frame a. /* just an example, only field-level widgets */
 
Top