[Gambas-user] BUG: Settings.Keys (gb.settings)

Lewis Balentine lewis at ...3412...
Thu Nov 27 20:08:34 CET 2014


The definitions I was quoting are from the first page of the Wiki for 
gb.settings.

"Property Read Keys As _Settings_Keys"
Return a virtual object used for enumerating all the keys used by the 
setting file.

I tried several things (including "Object") before I landed on "String".
... oh and I did try the syntax Settings.keys("SlotName")

"... Obviously (?) the keys are namespaced using a slot, so to enumerate 
all the keys ..."
Well not so obvious to an old fart like me.

I think the Wiki could use a few more examples in some cases.
It seems a  lot of this stuff is based on C++ and OOP conventions.
I have done a little work in "C" (/make that darn little/) but most of 
it was some decades ago.
For those of us coming from the ancient VB6 world just providing the 
function
definition (/declaration ?/) leaves us a big short of explanation as how 
to proceed.
It tends to be a process of trial and error (/sometimes a lot of the 
latter/).

I will try your example a little later and see if it works.

Thank you for the insight,

Lewis

On 11/27/2014 12:16 PM, Tobias Boege wrote:
> Key Definition: A value line, which is a "Key=Value" pair.
> Slot Definition: A slot line, which begins with a "[" character, and
> ends with a "]" character.
>
> Hmm, I'd define them a little differently: a "key" is not a value line but
> only the key part of a value line. "Slot" is not a slot line but the slot
> line minus the brackets.
>
> ... you can use _Settings_Keys to enumerate all the keys under each slot which sums to all
> the keys there are:
>
>    Dim sSlot, sKey As String
>
>    For Each sSlot In Settings.Keys
>      For Each sKey In Settings.Keys[sSlot]
>        Print sSlot &/ sKey
>      Next
>    Next
>
> If I was to vote, I'd not change the documentation as _Settings_Keys
> ultimately allows you to enumerate all the keys. Obviously (?) the keys
> are namespaced using a slot, so to enumerate all the keys, it makes sense
> to require that we go through the namespace level first.
>
> Regards,
> Tobi
>




More information about the User mailing list