[futurebasic] Re: [FB] Null events?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Joe Lertola <joefb@...>
Date: Tue, 5 Dec 2006 20:22:02 -0500
Brian,

Thanks, your code seems to work perfectly. I had gotten this feature  
working earlier today by using an On Timer function to check the  
position of the cursor, but I like your way better.

-Joe

On Dec 5, 2006, at 11:30 AM, Brian Stevens wrote:

>
> On Dec 5, 2006, at 6:31 AM, Joe Lertola wrote:
>
>> Brian,
>>
>> Your code is fine for changing the cursor when it moves over edit  
>> fields or buttons and I have that working in my program. My  
>> problem is I have color chips and a gradient bar control that I  
>> made with Paintrect commands. Here is the old window that I am  
>> trying to reproduce: http://www.joelertola.com/topo/ 
>> topo_interface2.html. I need to change the cursor to a pointing  
>> finger cursor when the cursor moves over the gradient bar or the  
>> color chips. My event loop does not get any _nullEvt events so I  
>> can't detect when this happens. Is there any solution for this?
>>
>
> Joe, here is an amendment showing how to detect a mouse over a  
> control (in this case a button). This is runnable and provides the  
> basics. You will need to retrieve and use the rect of your gradient  
> area instead of the button rect used here.
>
> HTH---Brian S.
>
>
> begin enum 1
> _Untitled1Wnd
> _cBtn
> _c1Btn
> end enum
>
>
> '~BuildUntitled1Wnd
> local fn BuildUntitled1Wnd
> '~'1
> dim as Rect                r
> dim as WindowAttributes    wa
>
> wa = _kWindowCloseBoxAttribute¬
>      _kWindowCollapseBoxAttribute¬
>      _kWindowFullZoomAttribute¬
>      _kWindowResizableAttribute
>
> //SetRect( r, 0, 0, 513, 319 )// Optional FB auto-centre
> SetRect( r, 682, 391, 1195, 710 )
> appearance window -_Untitled1Wnd, "Untitled 1", @r,  
> _kDocumentWindowClass, wa
> def SetWindowBackground( _kThemeActiveDialogBackgroundBrush, _zTrue )
>
>
> SetRect( r, 147, 139, 217, 159 )
> appearance button _cBtn, _activeBtn,,,, "Button", @r,  
> _kControlPushButtonProc
>
> SetRect( r, 269, 139, 339, 159 )
> appearance button _c1Btn, _activeBtn,,,, "Button2", @r,  
> _kControlPushButtonProc
>
> appearance window _Untitled1Wnd
> end fn
>
> local fn ChangeMyCursorAsAppropriate
> print "got here"
> end fn
>
> '~DoEvent
> local fn DoEvent
> dim ev as ^EventRecord
> dim as WindowRef      @ wNum
> dim as rect             btnRect
> dim as point            mousePt
>
> ev = event'PEEK at event record
> wNum = mouse(_mouseWindow)// get window number mouse is over
> select ev.what
> case _nullEvt
> select
> case wNum == _Untitled1Wnd
> fn FBGetControlRect(button&(_cBtn), btnRect)'get rect of button/ 
> control
> GetMouse( @mousePt )
>
> long if fn PtInRect(mousePt, btnRect)
> fn ChangeMyCursorAsAppropriate
> ev.what = _nullEvt'tells FB runtime not to do anything with this
> exit fn
> end if
> end select
> end select
> end fn
> '~Main
>
> on event fn DoEvent
> fn BuildUntitled1Wnd
>
> do
> handleevents
> until gFBquit
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>