Since it's a short, that should be -1, which is the constant kControlFocusNextPart. Now I see the problem, and I may have fixed it. The control now correctly calls GotFocus when it gets focus and LostFocus when it loses focus. Perhaps you could check. I've uploaded an updated version to my web site.

Charles Yeomans


On Oct 18, 2006, at 11:32 AM, Erne wrote:

Nope,

it's the buffer.Short(0) that is set to 65535

on 17-10-2006 23:25, Charles Yeomans at [EMAIL PROTECTED] wrote:

Do you mean that OSError is set to 65535?

Charles Yeomans

On Oct 17, 2006, at 5:04 PM, Erne wrote:

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


_______________________________________________
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>

Reply via email to