Bernie, I just found HIViewSetID and am testing it now. Thought about using globals but I have enough of those already. thanks for all your help. ~ steve On Nov 23, 2010, at 11:29 AM, Bernie wrote: > > Steve wrote: > >> So if I clear keyboard focus from this search field control how do I programmatically find the HIviewRef of this control without an ID number and set this field to be active using ? > > Good question! > > At first, I was going to suggest stuffing the search field ref in a global but if multiple windows share the same toolbar, the global may not point to the correct field. > > Been a while since I looked at this stuff, but OTTOMH how about assigning an ID to the field in MyCreateSearchField: > ..... > dim as HIViewID viewID > viewID.signature = _"Srch" > viewID.id = 1 > fn HIViewSetID( view, viewID ) > ..... > > And when you want to set focus: > ..... > dim as HIViewID viewID > dim as HIViewRef view > viewID.signature = _"Srch" > viewID.id = 1 > fn HIViewFindByID( fn HIViewGetRoot( w ), viewID, @view ) > fn SetKeyboardFocus( w, view, _kControlFocusNextPart ) > ..... > > There's gotta be a better way. > > Bernie > > -- > To unsubscribe, send ANY message to: futurebasic-unsubscribe@... >