[Gambas-user] Searching a key in the array of gb.settings

gambas at ...1938... gambas at ...1938...
Fri Nov 7 17:02:34 CET 2008


Hello List,

first question:
Is the settings-object an array or a collection??
Onlinehelp says: " ...acts like an read, write array" ....but the syntax for 
accessing its elements looks like collection.

Main-problem:
I'm writing a servicemenu which items should be configured through a 
settingsfile.
I have my seetings-array up and can access each element of it, when I know 
it's key.

My users only have a keypad with numbers from 0 to 9, so my settingsfile looks 
like this.

[Actions]
900 = "WriteToGambasML"
901 = "HaveACupOfCoffee"

and so on. The users choice is stored in a variable called: sItem

What I need to do is, check if the entered number is a valid choice in my 
servicemenue, but I don't know how.
A simple test for printing each element one by one of the collection??? 
doesn't work:

For Each sElement In hCFG["Actions"]
	Print sElement;
Next

Accessing a single element this way doesn't work, too:
Print hCFG["Action/sItem"] ...because the quotes masks sItem

This try gives me a syntax-error
Print hCFG["Action/"sItem]

Any ideas??

Sorry, if this a stupid question, but I'm still learning all this OO-stuff.

TIA
Stevie





More information about the User mailing list