RE: How can I make a field ready to receive typing?
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 09, 2003
- 380 views
> 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 > 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