Re: Win32Lib: Enable Focusability

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

don cole wrote:
> 
>  I would like to focus an EditText (cursor blinking ready for input)
>  right off on starting my program. I tried onOpen and many other things.
>  It will work only if I call it from a MenuItem or PushButton.
>  Any Ideas?
> 

The reason this happens is that the openWindow() (called from within WinMain) 
always sets focus on the window just opened. The Activate event is
triggered *after* the window is opened.

The two methods are ...

   WinMain( { PrimaryWindow, FirstFld }, Normal )

or 

  procedure Activate_PrimaryWindow(integer s, integer e, sequence p)
     setFocus( FirstFld )
  end procedure
  setHandler(PrimaryWindow, w32HActivate, routine_id("Activate_PrimaryWindow"))


To set focus on any window's control when it is opened, you can also do ...

   openWindow( { theWindow, theControl }, Normal)


BTW, all this is documented, with examples. It is not secret.

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu