Getting a certain Propoerties value to a label

I have a class called “japanese”
It has three properties (all strings)

japanese.dog =inu
japanese.cat=neko
japanese.mouse=nesumi

I have a weblabel1 and I wish to assign the value of the property to that to the text property

I could use weblabel1.shown —> me.text=japanese.dog --> (inu!)

But, because a lot more than just filling in the .text goes on I wish to Subclass WebLabel and be able to fill in the Target Property int he IDE

my_subclass.target_Property=“japanese.dog”

and finally in the open event call (Pseudo code)

me.text=target_Property.value

Perhaps I can get there using introspection?

please show how you are creating “Japanese” and where/how it is instantiated

simple source is here: http://138.197.210.221/forum_help.zip

Something like this?
https://www.dropbox.com/s/7zai4wlp2lihlex/DogLabel.xojo_code?dl=1
(drag the .xojo_code into the Navigator to use it)

Edit: I’m not sure if you can assign a class to a property using the Inspector in the IDE.

Thanks Tim.

The DogLabel will always return the value of japanese.dog

I wish to set a property target_property where target_property=“japanese.dog”

Are you always trying to get the Dog property though? I guess I don’t have the complete picture.

How is the control determining which property to use, or is that what you’re trying to select in the Inspector?
If that’s your goal, then yes you were on the right track with introspection!

Is target_property always the Japanese class?

is that what you’re trying to select in the Inspector? -->yes

target_property always the Japanese class?–>Yes

I could build a a case stamtent, but there must be a more elegant way

Take a look at this: https://www.dropbox.com/s/6g9y3nbyad512pz/Lablel-Introspection.xojo_binary_project?dl=1

I’ve implemented it as JapaneseLabel now. You set the clsJapanese object to it, and it will use the property value (it must be a string) for whatever property you type into the IDE inspector. It will raise an exception if it couldn’t find the property you typed in the IDE.

(post to bump thread because I edited my placeholder post)

Freaking Awesome Tim. Thanks!

(Now its time to dig in and really understand what you did!)