Hi
Please tell me about focus.
The condition of Evtroutine is push button and F10.
The same processing content, but the result is different.
Please tell me the reason why it is not the same.
* **************************************************
*
* COMPONENT: STD_FORM
*
* **************************************************
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(302) Left(794) Top(269) Formposition(ScreenCenter) Height(341)
Define_Com Class(#FLDA.Visual) Name(#FLDA) Componentversion(1) Displayposition(1) Height(23) Left(40) Parent(#COM_OWNER) Tabposition(1) Top(16) Usepicklist(False) Width(343) Caption('FLDA') Labeltype(Caption)
Define_Com Class(#FLDB.Visual) Name(#FLDB) Componentversion(1) Displayposition(2) Height(23) Left(40) Parent(#COM_OWNER) Tabposition(2) Top(48) Usepicklist(False) Width(343) Caption('FLDB') Labeltype(Caption)
Define_Com Class(#PRIM_PHBN) Name(#PHBN_2) Displayposition(3) Left(16) Parent(#COM_OWNER) Tabposition(3) Top(120) Caption('1.Set_Error For_Field(#FLDA #FLDB) 2.#FLDA.setfocus F10Key') Width(449)
Define_Com Class(#PRIM_STPG) Name(#STPG_2) Parent(#COM_OWNER) Shortcut(F10)
Evtroutine Handling(#com_owner.Initialize)
Set Com(#com_owner) Caption(*component_desc)
Endroutine
Evtroutine Handling(#PHBN_2.Click #STPG_2.Pressed)
Begincheck
Set_Error For_Field(#FLDA #FLDB)
#FLDA.setfocus
Endcheck
Endroutine
End_Com
I appreciate your kind advice.
Best Regards,
Shumpei
FORM-Focus difference
-
dannyoorburg
- Posts: 177
- Joined: Mon Jan 04, 2016 9:50 am
- Location: Australia
Re: FORM-Focus difference
Hi Shumpei,
they're different because of focus processing.
If you click the button, the BUTTON will become the focus control BEFORE it fires the click event.
If you hit F10, the FIELD stays the focus control.
A field losing focus clears the error state, and in case of the button click it will loose focus before the RDML runs, which is fine.
But in case of F10, it inadvertently loses and regains focus as part of the SetFocus processing, which happens AFTER the error state is set. Therefor the field gets cleared and appears not in error.
If you condition your SetFocus logic, as in:
your problem will go away.
Cheers,
Danny
they're different because of focus processing.
If you click the button, the BUTTON will become the focus control BEFORE it fires the click event.
If you hit F10, the FIELD stays the focus control.
A field losing focus clears the error state, and in case of the button click it will loose focus before the RDML runs, which is fine.
But in case of F10, it inadvertently loses and regains focus as part of the SetFocus processing, which happens AFTER the error state is set. Therefor the field gets cleared and appears not in error.
If you condition your SetFocus logic, as in:
Code: Select all
Begincheck
Set_Error For_Field(#FLDA #FLDB)
If (*Not #FLDA.Focus)
#FLDA.SetFocus
Endif
Endcheckyour problem will go away.
Cheers,
Danny
Re: FORM-Focus difference
Hi danny
Thank you for your answer.
I appreciate your kind response.
Let me check the recognition of the focus specification.
Please let me know in addition.
1.When you press the tab key, is the specification that focus is moved to the object?
2.When I press the tab key I moved to the next object and the reverse display disappears because it was LostFocused?
3.Is the reverse display disappear at the time of Lost Foucus? Or is the next object moved SetFocus?
Best Regards,
Shumpei
Thank you for your answer.
I appreciate your kind response.
Let me check the recognition of the focus specification.
Please let me know in addition.
1.When you press the tab key, is the specification that focus is moved to the object?
2.When I press the tab key I moved to the next object and the reverse display disappears because it was LostFocused?
3.Is the reverse display disappear at the time of Lost Foucus? Or is the next object moved SetFocus?
Best Regards,
Shumpei
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: FORM-Focus difference
Hi Shumpei
1. Focus will move to the next control in the tab sequence defined by TabPosition property
2. Yes, tabbing between controls resets the error state
3. The state will be reset whenever the runtime determines that it has the opportunity to update the display, so it cannot be linked directly to either of the events.
Regards
1. Focus will move to the next control in the tab sequence defined by TabPosition property
2. Yes, tabbing between controls resets the error state
3. The state will be reset whenever the runtime determines that it has the opportunity to update the display, so it cannot be linked directly to either of the events.
Regards
Re: FORM-Focus difference
Hi Stewart
Thank you for answering.
It will be saved because everyone will help us.
Best Regards,
Shumpei
Thank you for answering.
It will be saved because everyone will help us.
Best Regards,
Shumpei