Xojo Conferences
XDCMay2019MiamiUSA

reference object by string (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Who am I?
Next thread: Re: ScrollBar on Editfield


Text color   -   Barry Jaques
  reference object by string   -   Sunny Walker
   Re: reference object by string   -   Joseph J. Strout

reference object by string
Date: 03.02.04 20:35 (Tue, 03 Feb 2004 09:35:46 -1000)
From: Sunny Walker
is there a way to reference an object by a string?

i'm playing around with a little soundboard app. due to the nature of
the data options, the user selects the name of a sound from a series of
popup menus.

i've dragged a bunch of .wav files (for windows compat.) to my project
to create the object links, and i have the popups dynamically filled
based on each group using the english names as the list items and the
object names as the row tags.

i would like to be able to use something like this code in one of the
popups.change():

dim o as object
if (me.listindex>0) then 'index 0 is special with no rowtag
o=me.rowtag(me.listindex)
o.play
end if
me.listindex'reset selection to 0

first, is this possible? and second, am i missing some type-casting type
code?

thanks in advance,
sunny

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: reference object by string
Date: 03.02.04 20:50 (Tue, 3 Feb 2004 13:50:11 -0600)
From: Joseph J. Strout
At 9:35 AM -1000 2/3/04, Sunny Walker wrote:

>is there a way to reference an object by a string?

Not really. What you should do is make a Dictionary where the keys
are the sound files, and the values are the sound objects. Then you
can construct the name from the pop-ups, and use it to look up the
associated sound.

Cheers,
- Joe