Hi Charles,
in this function:
Case kEventControlSetFocusPart
dim buffer as new MemoryBlock(sizeOfShort)
dim OSError as Integer = GetEventParameter(EventRef,
kEventParamControlPart, typeControlPartCode, Nil, buffer.Size, Nil,
buffer)
If buffer.Short(0) = kControlFocusNoPart then
LostFocus
Else
GotFocus
End if
the GetEventParameter returns 65535 when the control is entered or
exited via keyboard tabbing (maybe an undefined system code)
it returns (correctly I guess) 5 when entered and 0 when exited via
mouse...
what am I missing?
My runaround trick:
Case kEventControlSetFocusPart
if me.HasFocus then
LostFocus
else
GotFocus
end if
'dim buffer as new MemoryBlock(sizeOfShort)
'dim OSError as Integer = GetEventParameter(EventRef,
kEventParamControlPart, typeControlPartCode, Nil, buffer.Size, Nil,
buffer)
'If buffer.Short(0) = kControlFocusNoPart then
'LostFocus
'Else
'GotFocus
'End if
Private Function HasFocus() As Boolean
#if TargetCarbon
Soft Declare Function HIViewSubtreeContainsFocus Lib CarbonLib
(HIViewRef as Integer) as Boolean
dim res as Boolean = HIViewSubtreeContainsFocus(HISearchFieldRef)
Return res
#endif
End Function
Cool Runnings,
Erne.
/ |\ |\ | /
– |/ | \ | –
\ |\ | \| \
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>