Addressing multiple UI elements (in this example, label)

Hi all.

I think this may actually be more an Xcode question but I’ll continue

I have on my interface, several labels, with their values bound to, for example, label01. I’ve bound them, rather than have them static, to aid rapid changes to the UI

So, we have several properties: label01, lable02, etc

Obviously, in the code, with now have:

 property Label01 : "Start"
    property Label02 : "after start"
    property Label03 : "nearly mid"
    property Label04 : "mid"
    property Label05 : "after mid"
    property Label06 : "nearly finish"
    property Label07 : "Finish"

Addressing these in the code is quite laborious, especially if, for example, you’d want to bold them all.

If there any way I can bind these to a list of some description so I can address them as

item i of my label01

Many thanks in advance

I’ll try to be a little bit clearer…

I want to create a list of properties.

property label1 : "10"
property label2 : "20"

set bob to {label1,label2} 

doesn’t mean that you get {label1,label2} but you get {value of label1, value of label2}

Effectively, I want a list of properties, not a list of the value of properties


Why don’t you us a single property as a dictionary (record) or an array (list)? You could dispatch your changes among their items.


That makes perfect sense, but for the fact that each property is then bound it’s own NSTextField label

Maybe you should consider a NSTextView or embed your NSTextField into a Matrix. as your data model may suggest.


I tried to write a little project to test my ideas, but I had to subclass a few. I guess there is a way to do this in pure ASOC – unless Objective-C does not scare you.

Wanted to say thanks to fiz for helping me offline with this :slight_smile: