1. Win32Lib: Enable Focusability

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?

Don Cole
SF

new topic     » topic index » view message » categorize

2. Re: Win32Lib: Enable Focusability

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?

Better minds than mine will no doubt answer, but in the interests of 
timeliness I recall that this won't work if you try to 
setFocus(EditText) on Window open. You have to do it from Window activate.

Dunno about - blinking cursor - though!

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib: Enable Focusability

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 message » categorize

4. Re: Win32Lib: Enable Focusability

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?

You can either focus it on startup of the window

   WinMain( {myWindow, myEditText}, Normal )

or, focus to it in the Activate event for the window.

   setFocus(myEditText)
   setIndex(myEditText, w32SelectAll)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu