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

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

> > 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.

Yeah, that's right.

And do something like this in an authenticate function:

required_password = get_password_from_database()
user_entered_password = ""
while not equal( user_entered_password , required_password ) do
    openDialog( Win2 ) -- during which user_entered_password is set...
end while

Of course, you'll want to limit this to X number of attempts...

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

Search



Quick Links

User menu

Not signed in.

Misc Menu