[Gtk-sharp-list] How to reference an object, given it's name?

Peter K. Gale pete@SoulCoffee.org
Wed, 27 Oct 2004 21:10:04 -0700


This is a cryptographically signed message in MIME format.

--------------ms070109070803050400060604
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi All,

Say you have an array of button objects named buttonA, buttonB, etc, and a
corresponding array of event objects named eventA, eventB, etc. I am
trying to find a clean way to link buttonX.Clicked with an action on
eventX.

When a button is clicked, the handler will be passed a reference to that
button object. Extracting the name of the button and changing the string
from "buttonX" to "eventX" is easy. I am having problems trying to use the
string "eventX" to reference the event object of the same name. Any ideas?
If the process is as clean as I hope it is, it's probably one line of code.

If anyone has a reference (or code snippet) for how to do this, it would
be greatly appreciated.

-Pete

-- 
"I believe we are on an irreversible trend toward
 more freedom and democracy, but that could change."

       --Governor George W. Bush, Jr.
         May 22, 1998


--------------ms070109070803050400060604
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIII8TCC
AtMwggI8oAMCAQICAwu3gzANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE
ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv
bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDQwMjE0MDQ1MzIyWhcNMDUwMjEzMDQ1MzIy
WjBFMR8wHQYDVQQDExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSIwIAYJKoZIhvcNAQkBFhNw
ZXRlQFNvdWxDb2ZmZWUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx6Gn
Jq2j1J2LZnxOjWyHIHQz8Ans8TunkS3aGSe+55VHJdT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