Thanks much. rc On Feb 3, 2010, at 11:54 AM, Ken Shmidheiser wrote: > Robert asked: > >> Any way to add detection of the number of clicks? > > Robert, > > The guys who wrote the CE handlers built in automatic detection of > just about everything you need. > > Ken > > /* > > Capturing Mouse Clicks > with Carbon Events > > Ken Shmidheiser > February 3, 2010 > > */ > > include "Util_CE.incl" > include "Tlbx CFString.incl" > > local fn MyMouseTrackingHandler( nextHandler as > EventHandlerCallRef, theEvent as EventRef, userData as pointer ) > '~'1 > dim as Str63 s > dim as UInt32 clicks > dim as OSStatus err, result : result = _eventNotHandledErr > > select ( fn GetEventClass( theEvent ) ) > case _kEventClassMouse > select ( fn GetEventKind( theEvent ) ) > > case _kEventMouseDown > err = fn GetEventParameter( theEvent, _kEventParamClickCount, > _typeUInt32, #0, sizeof( UInt32 ), #0, clicks ) > long if (clicks == 1 ) > s = "The mouse was clicked 1 time" > xelse > s = "The mouse was clicked" + Str$( clicks ) + " times > end if > > end select > end select > > fn SetButtonTextString( 1, s ) > > end fn = result > > local fn BuildCEWindow > '~'1 > dim as WindowRef w > dim as Rect r > dim as ControlFontStyleRec tfs > > SetRect( r, 0, 0, 500, 350 ) > appearance window 1, "CE Mouse Tracker", @r,_kDocumentWindowClass, > _kWindowStandardHandlerAttribute > SetRect( r, 20, 10, 480, 40 ) > appearance button 1,,,,,, @r, _kControlStaticTextProc > tfs.flags = _kControlUseJustMask > tfs.just = _teJustCenter > fn SetButtonFontStyle( 1, tfs ) > > w = window( _wndRef ) > > fn CEAddEvent( _kEventClassMouse, _kEventMouseDown ) > fn CEInstallWindowEventHandler( w, @fn MyMouseTrackingHandler, 0, 0 ) > > end fn > > fn BuildCEWindow > > RunApplicationEventLoop() > > -- > To unsubscribe, send ANY message to: futurebasic- > unsubscribe@... >