RE: How can I make a field ready to receive typing?

new topic     » goto parent     » topic index » view thread      » older message » newer message

> From: Louis at cwshop.com [mailto:Louis at cwshop.com] 
> 
> 
> OK Derek, thanks for your help.  Your example does work, BUT...
> 
> What I am trying to do is open a window at the beginning of 
> the program to check for a password, and if entered 
> correctly, then close the password window and open the main 
> window.  I find the initial window is considered the "main" 
> window and I cannot close it without killing off the entire 
> windowing system.  Therefore, I open a secondary window to 
> prompt for the password, but when I do this I must click on 
> the field or tab to it before typing is possible.
> 
> 
> procedure Open_Win2(integer self, integer event, sequence parms)
>     openDialog(Win2)
>     setFocus(Text21)   -- This doesn't do anything   sad
> end procedure
> setHandler(MainWin, w32HActivate, routine_id("Open_Win2"))

You need an onActivate handler for Win2:

procedure Activate_Win2(integer self, integer event, sequence parms)
    setFocus(Text21)
end procedure
setHandler(Win2, w32HActivate, routine_id("Activate_Win2"))

The reason for this is that when you use openDialog(), you start a nested
message loop, so the call to setFocus() doesn't happen until the dialog is
closed.

Matt Lewis

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu