Can the focus on a Form be controlled by a program?

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

Can the focus on a Form be controlled by a program?

Postby ArrayMac227 on Tue Nov 14, 2017 4:10 pm

Examples would be appreciated....
ArrayMac227
 
Posts: 62
Joined: Sat Sep 12, 2015 1:40 pm

Re: Can the focus on a Form be controlled by a program?

Postby paulmansour on Tue Nov 14, 2017 4:56 pm

Try:

Code: Select all
⎕NQ Object 'GotFocus'


Where object is the name of the form.
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Can the focus on a Form be controlled by a program?

Postby ArrayMac227 on Fri Nov 17, 2017 9:39 pm

Knew that already... are there other means?

In the expression I use, my 'Object' is a Button. Is that a problem?
ArrayMac227
 
Posts: 62
Joined: Sat Sep 12, 2015 1:40 pm

Re: Can the focus on a Form be controlled by a program?

Postby kai on Sun Nov 19, 2017 9:04 am

You ask a question, get an answer and then point out that you knew already.

Who else is going to answer I wonder.
User avatar
kai
 
Posts: 137
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Can the focus on a Form be controlled by a program?

Postby Vince|Dyalog on Mon Nov 20, 2017 9:56 am

Hi ArrayMac227,

You could also do it with ⎕NA and the win32 windows function.

      'f' ⎕WC 'form'
'f.b' ⎕WC 'button'
⎕NA 'P user32.dll|SetFocus P'
r←SetFocus f.e.Handle


Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Can the focus on a Form be controlled by a program?

Postby ArrayMac227 on Mon Nov 20, 2017 6:09 pm

Thanks to Vince for the reply. This bolsters my theory that setting the focus is problematic in my specific case:
. create a form;
. add an HTMLRenderer control, br,
. add an Ok Button: bnOk,
. Set the Default to 1 on bnOk
. add a Cancel Button: bnCx
. Set the Cancel to 1 on bnCx
. Set the Focus on bnCx,
. put a ⎕DQ on the form.

The expectation is that a press of Esc will close the form. Doesn't happen.

It _does_ work when Edit is substituted for HTMLRenderer.
A workaround: Alt+Tab, Alt+Tab to switch out and back into the Form does enable the Esc.
ArrayMac227
 
Posts: 62
Joined: Sat Sep 12, 2015 1:40 pm


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest