[futurebasic] Re: [FB] CFString

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

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sat, 19 Jan 2008 17:08:52 -0500
Steve asked (and I repeat for the second time):

> > dim as CFIndex brainsCFIndex, dessertCFIndex
>
> where do you assign the values to these ?



Steve,

Okay, I confess. It's been months since I sat down for a marathon  
coding session in FB.  I now realize I have forgotten most of what I  
learned (the total amount of which is best quantified by the adage:  
"If brains were dynamite, I wouldn't have enough to blow my nose.")

Back channel Bernie very kindly showed me the error of my ways. You  
were extremely astute to notice that I never assigned my CFIndexes   
(or would that be CFIndices?) their respective positions in the queue  
of the CFIndex byte bucket. Hence my code was blowing up and  
splattering all over me.

Below I think I do it right assigning shortDessertCFIndex to the  
first slot (I really find zero-based arrays annoying)  
andlongDessertCFIndex and second slot (which is really Slot 1-- see  
what I mean. Total confusion).


Ken

p.s. Can you tell I've been on a serious diet?  See what's on m y  
mind? No wonder I can't code worth a dang. Now where are those jelly  
donuts?

p.p.s I hope this runs for Max.


include "CFIndex.incl"
include "Tlbx CFString.incl"

dim as CFIndex shortDessertCFIndex, dessertCFIndex

shortDessertCFIndex = 0
longDessertCFIndex  = 1

fn CFIndexClear( shortDessertCFIndex )
fn CFIndex( shortDessertCFIndex, 0, "Apple pie"      )
fn CFIndex( shortDessertCFIndex, 1, "Cheese cake"    )
fn CFIndex( shortDessertCFIndex, 2, "Banana split"   )
fn CFIndex( shortDessertCFIndex, 3, "Fudge sundae"   )
fn CFIndex( shortDessertCFIndex, 4, "Chocolate cake" )
fn CFIndex( shortDessertCFIndex, 5, "Key lime pie"   )

fn CFIndexClear( longDessertCFIndex )
fn CFIndex( longDessertCFIndex, 0, "Apple pie with ice cream"          )
fn CFIndex( longDessertCFIndex, 1, "Cheese cake with cherries"         )
fn CFIndex( longDessertCFIndex, 2, "Banana split with pineapple"       )
fn CFIndex( longDessertCFIndex, 3, "Fudge sundae with whipped cream"   )
fn CFIndex( longDessertCFIndex, 4, "Chocolate cake with vanilla icing" )
fn CFIndex( longDessertCFIndex, 5, "Key lime pie with strawberries"    )

window 1,, (5, 45)-(400, 400)
dim as long i

print
print "Elements of shortDessertCFIndex:"
print

for i = 0 to fn CFIndexGetCount( shortDessertCFIndex ) -1
print "Element No."; i; " is: "; fn CFIndex$( shortDessertCFIndex, i )
next i

print
print "Elements of longDessertCFIndex:"
print

for i = 0 to fn CFIndexGetCount( longDessertCFIndex ) -1
print "Element No."; i; " is: "; fn CFIndex$( longDessertCFIndex, i )
next i

do
handleevents
until gFBQuit