Page 1 of 1
[SOLVED] information about a variable - or - blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 3:06pm
by PJBlack
ok ... i know it's easy ...
ok ... i know i didn't see a tree in the woods ...
my problem is:
i iterate trough
For Each sProp As String In Class.Load(oParent.Name).Symbols
and get (in sProp) a string value starting with ":" (Events), "$" (Private), "_" (Hidden) or 'nothing' (Var) and i'm fine with that.
with
Object.GetProperty(Me, sProp)
i get the current value ... ok nice but what i have to do to get for example the typeof the variable ... means what to do to get the
object(?) from a string value?
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 5:56pm
by cogier
Run the following code in a new "Graphical" application. I think this is what you are looking for.
ValueBox1 As ValueBox
TextArea1 As TextArea
Public Sub _new()
Setup
ValueBox1_Change()
End
Public Sub ValueBox1_Change()
Dim oObj As Object = ValueBox1
Dim sType As String[] = ["NULL", "Boolean", "Byte", "Short", "Integer", "Long", "Single", "Float", "Date", "String", "Object", "Pointer", "Function", "Class"]
Dim sProperty As String = "Value"
TextArea1.Clear
TextArea1.Text = Object.Type(oObj) & gb.NewLine
TextArea1.Text &= Object.GetProperty(oObj, sProperty) & gb.NewLine
TextArea1.Text &= sType[TypeOf(Object.GetProperty(oObj, sProperty))]
End
Public Sub Setup()
With Me
.Arrangement = Arrange.Vertical
.H = 300
.W = 500
.Padding = 5
.Text = "Change the value, use Integer, Float and Long"
End With
With ValueBox1 = New ValueBox(Me) As "ValueBox1"
.H = 28
.W = 100
End With
With TextArea1 = New TextArea(Me) As "TextArea1"
.H = 50
.W = 50
.Expand = True
End With
End
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 7:06pm
by PJBlack
thank you but maybe i'm not able to make clear what i'm looking for ...
cogier wrote: ↑Tuesday 16th March 2021 5:56pm
Dim oObj As Object = ValueBox1
i'm here:
Dim oObj As Object = "ValueBox1"
and i'm looking for:
Dim oObj As Object = ConvertThisStringToAnObject("ValueBox1")
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 7:14pm
by BruceSteers
PJBlack wrote: ↑Tuesday 16th March 2021 7:06pm
thank you but maybe i'm not able to make clear what i'm looking for ...
cogier wrote: ↑Tuesday 16th March 2021 5:56pm
Dim oObj As Object = ValueBox1
i'm here:
Dim oObj As Object = "ValueBox1"
and i'm looking for:
Dim oObj As Object = ConvertThisStringToAnObject("ValueBox1")
FMain["ValueBox1"]
also
Me.Window.Controls["ValueBox1"]
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 7:20pm
by PJBlack
thanks bruce but
Dim test As Integer = 0
Print FMain["test"]
give NULL
EDIT:
sometimes it's hard not to be an native english speaker
to be more detailed ... i have
For Each sProp As String In Class.Load(oParent.Name).Symbols
and i would like to have "sProp" converted back to something that i can use further
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 7:39pm
by BruceSteers
PJBlack wrote: ↑Tuesday 16th March 2021 7:20pm
thanks bruce but
Dim test As Integer = 0
Print FMain["test"]
give NULL
EDIT:
sometimes it's hard not to be an native english speaker
to be more detailed ... i have
For Each sProp As String In Class.Load(oParent.Name).Symbols
and i would like to have "sProp" converted back to something that i can use further
You said Object.
that's not an Object that's a Variable.
myClass = Class.Load(oParent.Name)
For Each sProp As String In myClass.Symbols
Debug myClass[sProp].Type
Debug myClass[sProp].Value
Next
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 7:48pm
by BruceSteers
BruceSteers wrote: ↑Tuesday 16th March 2021 7:39pm
PJBlack wrote: ↑Tuesday 16th March 2021 7:20pm
thanks bruce but
EDIT:
sometimes it's hard not to be an native english speaker
You said Object.
that's not an Object that's a Variable.
I'm not sure if speaking English helps ,
in that last statement I "Objected" to you saying "Object" ?!?
2 same words with completely different meaning?? it makes no sense at all !!
English can be crazy
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 9:23pm
by BruceSteers
Did I help a blind man see the light?
Re: blind man urgently seeks ophthalmologist or optician
Posted: Tuesday 16th March 2021 11:24pm
by PJBlack
BruceSteers wrote: ↑Tuesday 16th March 2021 7:39pm
You said Object.
that's not an Object that's a Variable.
isn't in OOP everything an object ???
BruceSteers wrote: ↑Tuesday 16th March 2021 7:39pm
myClass = Class.Load(oParent.Name)
For Each sProp As String In myClass.Symbols
Debug myClass[sProp].Type
Debug myClass[sProp].Value
Next
crazy ... how smart things work if they done right ...
BruceSteers wrote: ↑Tuesday 16th March 2021 9:23pm
Did I help a blind man see the light?
ah bruce ... what would I do without you?
it looks like my brain memory capacity is no longer sufficient to store more than three things ...
I knew it was that simple... and I've used this before... but unfortunately it seems to have fallen victim to my dementia/stupidity.
so many thanks to you bruce but also to charlie (i'll add steve here), always quick replies and VERY helpful !!!!
i'm off to search the forest among the trees with my 2¼ dogs
Re: blind man urgently seeks ophthalmologist or optician
Posted: Wednesday 17th March 2021 11:55am
by BruceSteers
PJBlack wrote: ↑Tuesday 16th March 2021 11:24pm
BruceSteers wrote: ↑Tuesday 16th March 2021 7:39pm
You said Object.
that's not an Object that's a Variable.
isn't in OOP everything an object ???
BruceSteers wrote: ↑Tuesday 16th March 2021 7:39pm
myClass = Class.Load(oParent.Name)
For Each sProp As String In myClass.Symbols
Debug myClass[sProp].Type
Debug myClass[sProp].Value
Next
crazy ... how smart things work if they done right ...
BruceSteers wrote: ↑Tuesday 16th March 2021 9:23pm
Did I help a blind man see the light?
ah bruce ... what would I do without you?
it looks like my brain memory capacity is no longer sufficient to store more than three things ...
I knew it was that simple... and I've used this before... but unfortunately it seems to have fallen victim to my dementia/stupidity.
so many thanks to you bruce but also to charlie (i'll add steve here), always quick replies and VERY helpful !!!!
i'm off to search the forest among the trees with my 2¼ dogs
whoop whoop
Gonna have to say OOP is only "orientated" like Objects but no. Ask the wrong questions get the wrong answers ,hehe
I'm sure you would have figured it out
Happy to help dude