Sack Library Documentation
sack::PSI::OnCommonFocus Macro
int (__cdecl * FocusChanged)(PSI_CONTROL pc, LOGICAL bFocused);
#define OnCommonFocus(name) \
    DefineRegistryMethodP(PSI_PRELOAD_PRIORITY,PSI_ROOT_REGISTRY,FocusChanged,WIDE("control"),name WIDE("/rtti"),WIDE("focus_changed"),int,(PSI_CONTROL,LOGICAL))

bFocused will be true if control gains focus if !bFocused, control is losing focus. 

Return type is actually void now. The below notes were for before.

  1. with current focus is told it will lose focus (!bFocus).
    1. control may allow focus loss (return !FALSE) (goto 3)
    2. control may reject focus loss, which will force it to remain (return FALSE)
  2. current focus reference of the container is cleared
  3. newly focused control is told it now has focus.
    1. it may accept the focus (return TRUE/!FALSE)
    2. it may reject the focus - and the focus will be left nowhere.
  4. the current focus reference of the container is set

Registers under 


static void OnCommonFocus(name)(PSI_CONTROL control, LOGICAL bFocused )
   // update control to show focus.  Buttons draw a line under themselves, list boxes highlight
   // edit fields draw a cursor for entering text...
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!