Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

MDIChild

ZakeZake Posts: 15Member
I'm creating a text editor that using a MDIChild for the edit box.
So I can create many child window from the main window. I also create a program that process an active child window. But when I run the program, every child window that I create is getting process all together.
I want to know how to tell which is the child window that currently active among the other child window, and tell the program to work only for that child window?

Comments

  • zibadianzibadian Posts: 6,349Member
    : I'm creating a text editor that using a MDIChild for the edit box.
    : So I can create many child window from the main window. I also create a program that process an active child window. But when I run the program, every child window that I create is getting process all together.
    : I want to know how to tell which is the child window that currently active among the other child window, and tell the program to work only for that child window?
    :
    THat's stored in the mainform's ActiveMDIChild property.
  • ZakeZake Posts: 15Member
    : THat's stored in the mainform's ActiveMDIChild property.
    :
    I'm sorry.... but can you tell me what is the command to tell the program to process only the Active child window?
  • zibadianzibadian Posts: 6,349Member
    : : THat's stored in the mainform's ActiveMDIChild property.
    : :
    : I'm sorry.... but can you tell me what is the command to tell the program to process only the Active child window?
    :
    This sample code will save to text in the active child (providing the memo on the active child is called Memo1):
    [code]
    ActiveMDIChild.Memo1.Lines.SaveToFile('SomeFile.txt');
    [/code]
  • ZakeZake Posts: 15Member
    : This sample code will save to text in the active child (providing the memo on the active child is called Memo1):
    : [code]
    : ActiveMDIChild.Memo1.Lines.SaveToFile('SomeFile.txt');
    : [/code]
    :
    I try it, and the program keep saying that Memo1 is unknown, eventhough my active child have Memo1 in it.
  • zibadianzibadian Posts: 6,349Member
    : : This sample code will save to text in the active child (providing the memo on the active child is called Memo1):
    : : [code]
    : : ActiveMDIChild.Memo1.Lines.SaveToFile('SomeFile.txt');
    : : [/code]
    : :
    : I try it, and the program keep saying that Memo1 is unknown, eventhough my active child have Memo1 in it.
    :
    I'm sorry. I completely forgot that you need to type-cast the ActiveMDIChild. Here is the way to type-cast the ActiveMDIChild:
    [code]
    (ActiveMDIChild as TForm2).Memo1.Lines.SaveToFile('SomeFile.txt');
    [/code]
    if the children are of the TForm2 type.
  • ZakeZake Posts: 15Member
    : I'm sorry. I completely forgot that you need to type-cast the ActiveMDIChild. Here is the way to type-cast the ActiveMDIChild:
    : [code]
    : (ActiveMDIChild as TForm2).Memo1.Lines.SaveToFile('SomeFile.txt');
    : [/code]
    : if the children are of the TForm2 type.
    :

    I'm sorry to trouble you again....
    But I tried it too, and the result said that "Operator not applicableto this opperand type". What went wrong?
  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2004-10-16 17:35:36[/red][/b][hr]
    : : I'm sorry. I completely forgot that you need to type-cast the ActiveMDIChild. Here is the way to type-cast the ActiveMDIChild:
    : : [code]
    : : (ActiveMDIChild as TForm2).Memo1.Lines.SaveToFile('SomeFile.txt');
    : : [/code]
    : : if the children are of the TForm2 type.
    : :
    :
    : I'm sorry to trouble you again....
    : But I tried it too, and the result said that "Operator not applicableto this opperand type". What went wrong?
    :
    You must have made a mistake in your code, because I just tested the code and it worked perfectly. If you post your coded I can see what's wrong.

  • ZakeZake Posts: 15Member
    : You must have made a mistake in your code, because I just tested the code and it worked perfectly. If you post your coded I can see what's wrong.
    :
    :
    You're right, my mistake. I forgot to put the T in front of the Form2.
    Thank you very much for your help.
Sign In or Register to comment.