Howdy, Stranger!

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

Categories

moving between delphi forms

Ok, I know this is simple and I have done it a long time ago, but I am trying to go back over delphi and having trouble with this at the momment. I want to add an about box to an application.

I have create the form, but cant call form2 ie the about box from form1 the main frame. I thought it was as simple a project1.form2.visible := true; or something along those lines, but I've had apsolutely no luck

Is there anyone that can put me out of my misery?


Comments

  • zibadianzibadian Member Posts: 6,349
    : Ok, I know this is simple and I have done it a long time ago, but I
    : am trying to go back over delphi and having trouble with this at the
    : momment. I want to add an about box to an application.
    :
    : I have create the form, but cant call form2 ie the about box from
    : form1 the main frame. I thought it was as simple a
    : project1.form2.visible := true; or something along those lines, but
    : I've had apsolutely no luck
    :
    : Is there anyone that can put me out of my misery?
    :
    :
    :
    Use the ShowModal() or Show() method of the TForm class.
  • gerardmcmanusgerardmcmanus Member Posts: 13
    : Use the ShowModal() or Show() method of the TForm class.

    no luck there either. I should explain alittle more though, you know how if you type project1.for.. and then press ctrl+space it gives you possible options, and tells you the expected parameters for functions and so on. Well it doesn't see form2, it only gives me form1 as an option, I can make form1 diss-appear and re-appear but cant get form1 to see form2 to use the control features for the object.

    thanks for your help, though its appriciated.
  • zibadianzibadian Member Posts: 6,349
    : : Use the ShowModal() or Show() method of the TForm class.
    :
    : no luck there either. I should explain alittle more though, you know
    : how if you type project1.for.. and then press ctrl+space it gives
    : you possible options, and tells you the expected parameters for
    : functions and so on. Well it doesn't see form2, it only gives me
    : form1 as an option, I can make form1 diss-appear and re-appear but
    : cant get form1 to see form2 to use the control features for the
    : object.
    :
    : thanks for your help, though its appriciated.
    :
    You need to add the name of the unit in which form2 is defined to the uses list of form1. Example:
    [code]
    unit MyForm1;

    interface

    uses
    Forms, ..., [b]MyForm2[/b];

    type
    TForm1 = class(TForm)
    ...
    end;

    var
    Form1: TForm;

    implementation

    ...

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Form2.ShowModal();
    end;

    end.
    [/code]
    I've left out the unrelevant parts of the code.
  • gerardmcmanusgerardmcmanus Member Posts: 13
    Thanks, that worked. You just made a very frustrate guy very happy. Thanks again.
Sign In or Register to comment.