Jump to content

[C++] Qual MDI Child Windows está seleccionada ???


Recommended Posts

Boas! 😉

A minha duvida é saber qual a janela child está seleccionada. :wallbash:

//Primeiro criei um array de forms

array<Form^> ^f;

//que pode ter por exemplo 50 forms

f = gcnew array<Form ^>(50);

//aparecem na parent window

for(int i=0 ; i < f->Length ; ++i)


  f [ i ] = gcnew Form();

  f [ i ] ->MdiParent=this;

  f [ i ] ->Show();


a minha duvida é saber agora qual das child windows tenho seleccionada...e colocar o valor numa variavel...

algo do genero:

int x= f->SelectedIndex;  //esta funçao nao existe...e nao encontro nada que faça algo assim  :wallbash:

para depois fazer por exemplo

f [ x ] ->Close();

bom forum, obrigado 😄

Link to comment
Share on other sites

Já descobri...

A resposta:

Form ^aux = this->ActiveMdiChild;

int index = int::Parse(aux->Name);

listBox1->Items->Add(String::Concat("Child Window Selected: ",index.ToString()));

return index;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.