Click to See Complete Forum and Search --> : Enumerate Controls on Form


Jinto
July 17th, 2004, 11:38 PM
Ok I want to enumerate the controls on the form..
But they are custom controls.. How can I cast it down from a standard control to my custom control?

SteamButton::SteamButtonControl *test = reinterpret_cast<SteamButton::SteamButtonControl>(this->Controls->get_Item(0));

Just an example I know the first control on the form is the one I want in this example..

SteamButtonControl is my custom control. It has custom methods that I can't access through Windows::Forms::Control..

Can any of you tell me how to get a pointer to the control.. So I can use my custom methods it has.

WhyDoesItNotWork...:-(
July 23rd, 2004, 09:40 AM
Ok it seems this fourm doesn't display angel brackets, will use sq instead, having looked at the source of the page I've discovered that you have not cast your SteamButtonControl as a pointer i.e. SteamButtonControl * SButton1 = dynamic_cast[SteamButtonControl*](controlEnumerator->Current);

Could this be your problem?
-Y