Top Level Forms and Focus
Posted: Thu Jan 12, 2012 3:50 pm
Consider the following code:
If you execute this in the session, Form F5 will be on top and F1 will be on the bottom.
(If you run it in a function the reverse will be true. In this case to see the behavior I want to show below, simply click on the forms to get them in to the opposite order, with F5 on top)
Now close form F5. When the form closes, the focus goes to F1, currently behind F2,F3, etc, and all the way on bottom. So F1 then comes to the top.
Some questions:
0. This is long standing Dyalog behavior so I assume it is not a bug. Correct?
1. Why wouldn't the focus go to the top-most form, in this case F4, rather than the form that was created first, F1? The current behavior seems unnatural.
2. Is it indeed true, as I have observed, that the first created form is the one that will get the focus when any other form is closed?
3. What, if any, is the name of the ordering that controls this behavior? It is not (I think) "z-order" which simply describes what the order of the stacking of the forms is.
3. Is there a direct way in Dyalog to change this behavior, so that the focus goes to the form on the top of z-order, rather than the form that was created first?
4. Is there a way using []NA?
4. Or should I just track everything my self and manually set the focus back to form that most recently had it when another form is closed?
Any pointers or comments or answers would be greatly appreciated.
Code: Select all
'F1'⎕WC'Form' 'Form1'
'F2'⎕WC'Form' 'Form2'('Posn'(F1.Posn+2))
'F3'⎕WC'Form' 'Form3'('Posn'(F2.Posn+2))
'F4'⎕WC'Form' 'Form3'('Posn'(F3.Posn+2))
'F5'⎕WC'Form' 'Form3'('Posn'(F4.Posn+2))
If you execute this in the session, Form F5 will be on top and F1 will be on the bottom.
(If you run it in a function the reverse will be true. In this case to see the behavior I want to show below, simply click on the forms to get them in to the opposite order, with F5 on top)
Now close form F5. When the form closes, the focus goes to F1, currently behind F2,F3, etc, and all the way on bottom. So F1 then comes to the top.
Some questions:
0. This is long standing Dyalog behavior so I assume it is not a bug. Correct?
1. Why wouldn't the focus go to the top-most form, in this case F4, rather than the form that was created first, F1? The current behavior seems unnatural.
2. Is it indeed true, as I have observed, that the first created form is the one that will get the focus when any other form is closed?
3. What, if any, is the name of the ordering that controls this behavior? It is not (I think) "z-order" which simply describes what the order of the stacking of the forms is.
3. Is there a direct way in Dyalog to change this behavior, so that the focus goes to the form on the top of z-order, rather than the form that was created first?
4. Is there a way using []NA?
4. Or should I just track everything my self and manually set the focus back to form that most recently had it when another form is closed?
Any pointers or comments or answers would be greatly appreciated.