Article # 687, added by Geoworks, historical record
| first | previous | index | next | last |

Getting focused object for objects not in focus path.



Q. Now I'd like to know which one of the FileSelectors (FFS1 or FFS2)
   is currently active. A function or message that returns optr to
   the active FileSelector would do fine. Or a Boolean value (are you
   or are you not active). But the best would be if I could send
   message encapsulated TO_APP_FOCUS (or something) and intercept it
   in the active FileSelector object. 

   Keeping track of TAB presses or NAVIGATE_TO_NEXT_FIELD messages
   doesn't sound good.

   Since the source of the problem is that FileSelectors are not part
   of the focus path, I could add a new layer of GenViews and
   GenContents between TabObjectsHolder and those FileSelectors (and
   get rid of TabView and TabContent objects). This seems to work but
   sounds a bit heavy way to ask which FileSelector is active.

A. Since the FFileSelector gets converted into a view/content/items
   (unfortunately), the only way to get a known object in the focus
   hierarchy is by adding a GenView/GenContent between TabObjectsHolder
   and the FFileSelectorClass objects. 

   Once you have a known object within the focus heirarchy, you can send 
   MSG_META_GET_FOCUS_EXCL to the GenContent of the TabView. This will
   return an optr to the GenView that contains the FFileSelector that
   currently has the focus.

   So here is what your GenTree should look like
   TabApp (FoamSubApplicationClass)
       TabPrimary (GenPrimaryClass)
	   TabView (TabViewClass->GenViewClass)  * monitors keypresses *
	       TabContent (GenContentClass)
		   TabObjectsHolder (GenInteractionClass)
		      FFS1View (GenViewClass)
 		          FFS1Content (GenContentClass)
		              FFS1 (FFileSelectorClass)
		      FFS2View (GenViewClass)
 		          FFS2Content (GenContentClass)
		              FFS2 (FFileSelectorClass)
	   CloseTrigger (ComplexMonikerClass:GenTriggerClass)

   If you send MSG_META_GET_FOCUS_EXCL to TabObjectsHolder, it will
   return the optr of either FFS1View or FFS2View. You could optionally
   subclass the GenView for FFS1View and FFS2View so that they return
   the optr of FFS1 or FFS2 (respectively).


Q. Or is it somehow possible to add a GenInteraction object behind
   FileSelector so that the GenInteraction would be in the focus path?
   (e.g. TabObjectsHolder is not)

A. That would not work because a GenInteraction cannot be in the focus
   path unless it is a dialog or popup. Here is some information from
   Include\ui.def about which objects can be in the focus heirarchy: 

   ;Focus nodes in Generic UI library: GenSystem
   ;				    GenField
   ;				    GenApplication
   ;				    GenPrimary
   ;				    GenDisplayControl
   ;				    GenDisplay
   ;				    GenView
   ;				    GenInteraction (Indep. displayable only)