Monday, June 24, 2019

Tip of the Day: Improved Control Focus for Form Controls
Product.......: R:BASE X.5 and R:BASE X.5 Enterprise (Version 10.5)
Build.........: 10.5.1.30523 or higher
Sections......: Forms
Keywords......: Commands, Focus, SET_FOCUS, Active Control, PROPERTY

When using SET_FOCUS to change the input focus to a control, it can have
negative effects in some scenarios. SET_FOCUS steals the focus on a global
level. That means, if a control in a non active form gets a SET_FOCUS, the
non active form becomes the active form and the control is given the focus.
This behavior does not blend well with popup forms (Pop-up Menu, CHOOSE,
etc.) that are shown during focus transition.

As such, SET_ACTIVE_CONTROL and DELAYED_SET_ACTIVE_CONTROL have been
introduced to gain focus in a more "respectful" way.

  PROPERTY ComponentID SET_ACTIVE_CONTROL TRUE
  or
  PROPERTY ComponentID DELAYED_SET_ACTIVE_CONTROL TRUE

If SET_ACTIVE_CONTROL is used, the control will have focus if the parent form
is the active form (works like SET_FOCUS). However, if the parent form is not
the active form, the control will get the focus when the parent form becomes
the active form. The "parent form recognition" is the difference maker. The
PROPERTY command use does not get in the way of other forms.

With DELAYED_SET_ACTIVE_CONTROL, the focus switch implemented uses PostMessage(), a safer cross-origin communication between Windows objects, and allows the focus
cycle to be completed before a new focus switch cycle is started. The focus
switch is basically "delayed."

Below explains each focus method:

 . SET_FOCUS - moves focus to the specified control. If parent form is not the
   active form, it will become the active form as well.
. SKIP - works like SET_FOCUS but uses the Tab Order to determine which control
   to focus to.
. SET_ACTIVE_CONTROL - moves the focus to the specified control. If parent form is not the active control, the focus switch will happen when the parent form
    becomes the active form.
 . DELAYED_SET_FOCUS - delayed SET_FOCUS
 . DELAYED_SET_ACTIVE_CONTROL - delayed SET_ACTIVE_CONTROL

Because it can be cumbersome to change SET_FOCUS into SET_ACTIVE_CONTROL or
DELAYED_SET_ACTIVE_CONTROL in many places, a newly added APPLICATION property
was implemented to treat SET_FOCUS commands as different "focus" counterpart.

  PROPERTY APPLICATION DELAYED_FOCUS_SWITCH ON|OFF

SET_FOCUS, SET_ACTIVE_CONTROL, and SKIP will work like DELAYED_SET_ACTIVE_CONTROL
when the setting is ON!

Very Best R:egards,

Razzak.

https://www.rbase.com
http://www.facebook.com/rbase/

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- You received this message because you are subscribed to the Google Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rbase-l+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/201906241947.x5OJlWMg022902%40atl4mhob06.registeredsite.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to