[futurebasic] Re: [FB] Live action sliders in FBtoC

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Tue, 29 Apr 2008 19:00:03 +1200
Walter Lenk wrote:

> I am converting another program for FBtoC, and I have been stumped as
> to how to get 'live slider action' to translate properly to C.
>
> Using the older command
> SCROLL BUTTON 11,1,1,100,10,@rect1,_scrollOther
> I can get 'live slider action' in C, unless 'ON MOUSE' interferes  
> (see below).
>
> Using the newer command
> Appearance Button 12, _activeBtn,1,1,100,"",@rect1,_kControlSliderProc
>   _kControlSliderLiveFeedback _kControlSliderNonDirectional
> I get neither the requested "live slider action' or the round  
> control in
> C. Any live action is even further impeded when 'ON MOUSE' interferes.
>
>
> When the program has an 'ON MOUSE' routine, this routine appears to
> grab mouse control before 'ON DIALOG' is called. All 'live slider
> action' is suspended in C (but not FB) when the 'ON MOUSE' routine
> has a loop like this in it:
>   WHILE FN BUTTON
>     CALL GETMOUSE(MsPt)
>     ' Do Something here.....
>   WEND


I fixed the 'on mouse' bug for the next version of FBtoC:
352	Closed		'on mouse fn DoMouse' interferes with button handling

If you are feeling adventurous, you could make the fix in  
FBMouseHandler (in build_goodies/AppThings.c). Replace the existing  
function by the version below, then save AppThings.c.

static OSStatus FBMouseHandler( EventHandlerCallRef inCaller, EventRef  
theEvent, void* inRefcon __attribute__ ((__unused__)) )
{
	OSStatus result = CallNextEventHandler( inCaller, theEvent );
	if ( result == eventNotHandledErr )
	{
		GetEventParameter( theEvent, kEventParamWindowMouseLocation,  
typeQDPoint, NULL, sizeof( Point ), NULL, &gFBLastMousePt );
		GetEventParameter( theEvent, kEventParamClickCount, typeUInt32,  
NULL, sizeof( UInt32 ), NULL, &gFBMouseClickCount );
		if ( gFBOnMouseVector ) (*gFBOnMouseVector)(); // call user's  
DoMouse function, if defined
	}
     return result;
}


The live-slider bug needs more thought. The FBtoC team recently  
considered a similar bug affecting another live-tracking control  
(little-arrows), without reaching a fully satisfactory fix. Scroll  
buttons (in effect a combination of slider + litle-arrows) work OK,  
and so the simpler controls are surely fixable.

Robert P.