[futurebasic] Re: [FB] Carbon Problems

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2002 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Sun, 4 Aug 2002 13:15:40 +1200
On Saturday, August 3, 2002, at 10:45  AM, Craig Hoyt wrote:

> Thanks for the feedback all,
>
> Button issue:
> Staz said...
>> you don't get to produce a framed button in carbon. not really. in x, 
>> the
>> default button pulsates. that's a whole different animal.
> RP said...
>> Thus one solution might be for you to switch to the Appearance runtime.
>
> Since it is confirmed that this issue is not confined to my computer, 
> I'm
> thinking this is a bug. A carbon compile running in 9.x should behave 
> the
> same as a PPC compile. This does not.



Here is a workaround that allows you to make a framed (pulsing in OS X) 
push-button in a Standard Basic Carbon compile.
Clumsy, but it seems to do the job.


#if def _appearanceRuntime
compile shutdown "Demo for Standard Basic runtime only
#endif



#if CarbonLib
toolbox fn SetControlData(ControlRef, ControlPartCode inPart, ¬
          ResType inTagName, long inSize, ptr * inData) = OSErr

local mode
local fn ConvertBtnToShadow( btnNum as short )
dim as OSErr     err
dim as boolean @ bool
bool = _zTrue
err  = fn SetControlData( button&( btnNum ), 0, _"dflt", 1, bool )
DrawOneControl( button&( 1 ) )
end fn

#endif


window 1

#if CarbonLib // special workaround
button 1, _activeBtn, "OK", (100,100)-(200,120), _push
fn ConvertBtnToShadow( 1 )
#else // normal code
button 1, 1, "OK", (100,100)-(200,120), _shadow
#endif

do
HandleEvents
until 0


Robert P.