[futurebasic] Re: [FB] Radio Buttons

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

From: Ken Shmidheiser <kshmidheiser@...>
Date: Thu, 17 Jan 2008 09:20:56 -0500
George wrote:

> Wow, Ken.   When you relax for a few minutes at the keyboard, you  
> cover a great deal of ground.   Wonderful demo of a popup, regular  
> buttons and radio.   You give me hope!
>
> Clean, clean, clean.


George,

Thanks, but when I woke up this morning I immediately saw some  
hideous code in the Nonsensical Demo. I plead sleep deprivation. A  
beautified replacement function can be found at the bottom of this post.

I hereby repent in sackcloth and [brain] ashes which reminds me of  
what Robert Spoecker earlier wrote:

> I am frying my poor brains with this stuff. I think I will go watch  
> some TV and finish frying my brain.


Ah yes, the smell of frying brain early in the morning!

Welcome to the club!

Ken


// Set text in an Edit Text field
local fn DoColor( colorStr as str15 )
dim as ControlFontStyleRec tfs
dim as RGBColor          backRGB
dim as long              r, g, b

// Create individual color table components
select case ( colorStr )
case "Black"  : r = 0     : g = 0     : b = 0
case "Brown"  : r = 60000 : g = 40000 : b = 20000
case "Red"    : r = 65535 : g = 0     : b = 0
case "Orange" : r = 65535 : g = 30000 : b = 0
case "Yellow" : r = 65535 : g = 65535 : b = 0
case "Green"  : r = 0     : g = 65535 : b = 0
case "Blue"   : r = 0     : g = 0     : b = 65535
case "Violet" : r = 65535 : g = 0     : b = 65535
case "Gray"   : r = 50000 : g = 50000 : b = 50000
case "White"  : r = 65535 : g = 65535 : b = 65535
end select

// Assign rgb  components to a complete RGBColor
backRGB.red = r : backRGB.green = g : backRGB.blue = b
tfs.flags   = _kControlUseBackColorMask
tfs.backColor = backRGB

// Pop the RGBColor into the colorized Edit Text field...
def SetButtonFontStyle ( _rgbField, tfs  )
//.. and force the field to refresh
def SetButtonTextString( _rgbField, ""   )

// Set the text in the response Edit Text field
def SetButtonTextString( _colorField, colorStr )

end fn