[SOLVED] information about a variable - or - blind man urgently seeks ophthalmologist or optician

Post

Posted
Rating:
#1 (In Topic #621)
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
ok … i know it's easy …
ok … i know i didn't see a tree in the woods …

my problem is:

i iterate trough

Code (gambas)

  1. 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

Code (gambas)

  1.         Object.GetProperty(Me, sProp)
  2.  
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?
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Run the following code in a new "Graphical" application. I think this is what you are looking for.

Code (gambas)

  1. ValueBox1 As ValueBox
  2. TextArea1 As TextArea
  3.  
  4. Public Sub _new()
  5.  
  6.   Setup
  7.   ValueBox1_Change()
  8.  
  9.  
  10. Public Sub ValueBox1_Change()
  11.  
  12.   Dim oObj As Object = ValueBox1
  13.   Dim sType As String[] = ["NULL", "Boolean", "Byte", "Short", "Integer", "Long", "Single", "Float", "Date", "String", "Object", "Pointer", "Function", "Class"]
  14.   Dim sProperty As String = "Value"
  15.  
  16.   TextArea1.Clear
  17.  
  18.   TextArea1.Text = Object.Type(oObj) & gb.NewLine
  19.   TextArea1.Text &= Object.GetProperty(oObj, sProperty) & gb.NewLine
  20.   TextArea1.Text &= sType[TypeOf(Object.GetProperty(oObj, sProperty))]
  21.  
  22.  
  23. Public Sub Setup()
  24.  
  25.   With Me
  26.     .Arrangement = Arrange.Vertical
  27.     .H = 300
  28.     .W = 500
  29.     .Padding = 5
  30.     .Text = "Change the value, use Integer, Float and Long"
  31.  
  32.   With ValueBox1 = New ValueBox(Me) As "ValueBox1"
  33.     .H = 28
  34.     .W = 100
  35.  
  36.   With TextArea1 = New TextArea(Me) As "TextArea1"
  37.     .H = 50
  38.     .W = 50
  39.     .Expand = True
  40.  
  41.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
thank you but maybe i'm not able to make clear what i'm looking for …

cogier said

Code (gambas)

  1. Dim oObj As Object = ValueBox1
  2.  

i'm here:

Code (gambas)

  1. Dim oObj As Object = "ValueBox1"
  2.  

and i'm looking for:

Code (gambas)

  1. Dim oObj As Object = ConvertThisStringToAnObject("ValueBox1")
  2.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

thank you but maybe i'm not able to make clear what i'm looking for …

cogier said

Code (gambas)

  1. Dim oObj As Object = ValueBox1
  2.  

i'm here:

Code (gambas)

  1. Dim oObj As Object = "ValueBox1"
  2.  

and i'm looking for:

Code (gambas)

  1. Dim oObj As Object = ConvertThisStringToAnObject("ValueBox1")
  2.  

FMain["ValueBox1"]

also
Me.Window.Controls["ValueBox1"]
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
thanks bruce but

Code (gambas)

  1.     Dim test As Integer = 0
  2.  
  3.     Print FMain["test"]
  4.  

give NULL

EDIT:
sometimes it's hard not to be an native english speaker  :roll:

to be more detailed … i have

Code (gambas)

  1. 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
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

thanks bruce but

Code (gambas)

  1.     Dim test As Integer = 0
  2.  
  3.     Print FMain["test"]
  4.  

give NULL

EDIT:
sometimes it's hard not to be an native english speaker  :roll:

to be more detailed … i have

Code (gambas)

  1. 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.

Code (gambas)

  1.  
  2. myClass = Class.Load(oParent.Name)
  3.  
  4. For Each sProp As String In myClass.Symbols
  5. Debug myClass[sProp].Type
  6. Debug myClass[sProp].Value
  7.  
  8.  
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’

BruceSteers said

PJBlack said

thanks bruce but

EDIT:
sometimes it's hard not to be an native english speaker  :roll:

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
:lol:
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’
Did I help a blind man see the light?
<EMOJI seq="1f609" tseq="1f609">πŸ˜‰</EMOJI>
<EMOJI seq="1f607" tseq="1f607">πŸ˜‡</EMOJI>
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’

BruceSteers said

You said Object.
that's not an Object that's a Variable.

isn't in OOP everything an object ???

BruceSteers said

Code (gambas)

  1. myClass = Class.Load(oParent.Name)
  2.  
  3. For Each sProp As String In myClass.Symbols
  4. Debug myClass[sProp].Type
  5. Debug myClass[sProp].Value
  6.  

crazy … how smart things work if they done right …  :roll:

BruceSteers said

Did I help a blind man see the light?
<EMOJI seq="1f609" tseq="1f609">πŸ˜‰</EMOJI>
<EMOJI seq="1f607" tseq="1f607">πŸ˜‡</EMOJI>

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
Online now: No Back to the top

Post

Posted
Rating:
#10
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

BruceSteers said

You said Object.
that's not an Object that's a Variable.

isn't in OOP everything an object ???

BruceSteers said

Code (gambas)

  1. myClass = Class.Load(oParent.Name)
  2.  
  3. For Each sProp As String In myClass.Symbols
  4. Debug myClass[sProp].Type
  5. Debug myClass[sProp].Value
  6.  

crazy … how smart things work if they done right …  :roll:

BruceSteers said

Did I help a blind man see the light?
<EMOJI seq="1f609" tseq="1f609">πŸ˜‰</EMOJI>
<EMOJI seq="1f607" tseq="1f607">πŸ˜‡</EMOJI>

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  ;) :lol:

I'm sure you would have figured it out :)
Happy to help dude :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.