moving credits

how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!

Comments

  • [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    :
    The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    [code]
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    Memo1.Lines.Delete(0); // Delete the top line
    Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    if Timer1.Tag = Memo2.Lines.Count then
    Timer1.Tag := 0; // Start from the beginning again.
    end;
    [/code]


  • : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : :
    : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : [code]
    : procedure TForm1.Timer1Timer(Sender: TObject);
    : begin
    : Memo1.Lines.Delete(0); // Delete the top line
    : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : if Timer1.Tag = Memo2.Lines.Count then
    : Timer1.Tag := 0; // Start from the beginning again.
    : end;
    : [/code]
    :
    :

    You can put all the lines in 1 memo and mark it disabled and no scrollbars. On Timer1.Timer put the first line of the memo in the buttom of the memo.

    I find this a better solution

  • : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : :
    : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : [code]
    : procedure TForm1.Timer1Timer(Sender: TObject);
    : begin
    : Memo1.Lines.Delete(0); // Delete the top line
    : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : if Timer1.Tag = Memo2.Lines.Count then
    : Timer1.Tag := 0; // Start from the beginning again.
    : end;
    : [/code]
    :
    :
    :
    ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
  • : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : :
    : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : [code]
    : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : begin
    : : Memo1.Lines.Delete(0); // Delete the top line
    : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : if Timer1.Tag = Memo2.Lines.Count then
    : : Timer1.Tag := 0; // Start from the beginning again.
    : : end;
    : : [/code]
    : :
    : :
    : :
    : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    :
    A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
  • : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : :
    : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : [code]
    : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : begin
    : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : end;
    : : : [/code]
    : : :
    : : :
    : : :
    : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : :
    : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    :


    ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
  • : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : :
    : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : [code]
    : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : begin
    : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : end;
    : : : : [/code]
    : : : :
    : : : :
    : : : :
    : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : :
    : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : :
    :
    :
    : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    :
    The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    [code]
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    Form2:=TForm.Create(Application); // Create the password form
    Form2.ShowModal; // show it
    if Form2.Edit1<>'password' then begin
    ShowMessage('Invalid password! Terminating program');
    Close; // Close program
    end;
    Form2.Free; // Free memory
    end;
    [/code]
    This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
  • : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : :
    : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : [code]
    : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : begin
    : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : end;
    : : : : : [/code]
    : : : : :
    : : : : :
    : : : : :
    : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : :
    : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : :
    : :
    : :
    : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : :
    : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : [code]
    : procedure TForm1.FormCreate(Sender: TObject);
    : begin
    : Form2:=TForm.Create(Application); // Create the password form
    : Form2.ShowModal; // show it
    : if Form2.Edit1<>'password' then begin
    : ShowMessage('Invalid password! Terminating program');
    : Close; // Close program
    : end;
    : Form2.Free; // Free memory
    : end;
    : [/code]
    : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    :



    ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
  • : : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : : :
    : : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : : [code]
    : : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : : begin
    : : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : : end;
    : : : : : : [/code]
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : : :
    : : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : : :
    : : :
    : : :
    : : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : : :
    : : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : : [code]
    : : procedure TForm1.FormCreate(Sender: TObject);
    : : begin
    : : Form2:=TForm.Create(Application); // Create the password form
    : : Form2.ShowModal; // show it
    : : if Form2.Edit1<>'password' then begin
    : : ShowMessage('Invalid password! Terminating program');
    : : Close; // Close program
    : : end;
    : : Form2.Free; // Free memory
    : : end;
    : : [/code]
    : : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    : :
    :
    :
    :
    : ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    : i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
    :
    I see. Here is the code for the OnClick() event of the button. This will check the validity of the password and then show the second form.
    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if Edit1.Text='Password' then
    Form2.ShowModal;
    end;
    [/code]

  • : : : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : : : :
    : : : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : : : [code]
    : : : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : : : begin
    : : : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : : : end;
    : : : : : : : [/code]
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : : : :
    : : : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : : : :
    : : : :
    : : : :
    : : : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : : : :
    : : : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : : : [code]
    : : : procedure TForm1.FormCreate(Sender: TObject);
    : : : begin
    : : : Form2:=TForm.Create(Application); // Create the password form
    : : : Form2.ShowModal; // show it
    : : : if Form2.Edit1<>'password' then begin
    : : : ShowMessage('Invalid password! Terminating program');
    : : : Close; // Close program
    : : : end;
    : : : Form2.Free; // Free memory
    : : : end;
    : : : [/code]
    : : : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    : : :
    : :
    : :
    : :
    : : ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    : : i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
    : :
    : I see. Here is the code for the OnClick() event of the button. This will check the validity of the password and then show the second form.
    : [code]
    : procedure TForm1.Button1Click(Sender: TObject);
    : begin
    : if Edit1.Text='Password' then
    : Form2.ShowModal;
    : end;
    : [/code]
    :
    :
    thanks! now all i need is to know how to make the message box pop up if the password is wrong??
    do i put this code:

    if Edit1.Text= ('') then
    ShowMessage ('Password Invalid')

    do i put that after your code?
    thanks!
    do i put it after
  • [b][red]This message was edited by the zibadian at 2002-5-26 23:13:32[/red][/b][hr]
    : : : : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : : : : :
    : : : : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : : : : [code]
    : : : : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : : : : begin
    : : : : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : : : : end;
    : : : : : : : : [/code]
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : : : : :
    : : : : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : : : : :
    : : : : :
    : : : : :
    : : : : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : : : : :
    : : : : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : : : : [code]
    : : : : procedure TForm1.FormCreate(Sender: TObject);
    : : : : begin
    : : : : Form2:=TForm.Create(Application); // Create the password form
    : : : : Form2.ShowModal; // show it
    : : : : if Form2.Edit1<>'password' then begin
    : : : : ShowMessage('Invalid password! Terminating program');
    : : : : Close; // Close program
    : : : : end;
    : : : : Form2.Free; // Free memory
    : : : : end;
    : : : : [/code]
    : : : : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    : : : :
    : : :
    : : :
    : : :
    : : : ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    : : : i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
    : : :
    : : I see. Here is the code for the OnClick() event of the button. This will check the validity of the password and then show the second form.
    : : [code]
    : : procedure TForm1.Button1Click(Sender: TObject);
    : : begin
    : : if Edit1.Text='Password' then
    : : Form2.ShowModal;
    : : end;
    : : [/code]
    : :
    : :
    : thanks! now all i need is to know how to make the message box pop up if the password is wrong??
    : do i put this code:
    :
    : if Edit1.Text= ('') then
    : ShowMessage ('Password Invalid')
    :
    : do i put that after your code?
    : thanks!
    : do i put it after
    :
    Add an else statement to the it-then. Something like this:
    [code]
    : : if Edit1.Text='Password' then
    : : Form2.ShowModal
    else
    ShowMessage('Password Invalid');
    [/code]


  • : [b][red]This message was edited by the zibadian at 2002-5-26 23:13:32[/red][/b][hr]
    : : : : : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : : : : : :
    : : : : : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : : : : : [code]
    : : : : : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : : : : : begin
    : : : : : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : : : : : end;
    : : : : : : : : : [/code]
    : : : : : : : : :
    : : : : : : : : :
    : : : : : : : : :
    : : : : : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : : : : : :
    : : : : : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : : : : : :
    : : : : : :
    : : : : : :
    : : : : : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : : : : : :
    : : : : : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : : : : : [code]
    : : : : : procedure TForm1.FormCreate(Sender: TObject);
    : : : : : begin
    : : : : : Form2:=TForm.Create(Application); // Create the password form
    : : : : : Form2.ShowModal; // show it
    : : : : : if Form2.Edit1<>'password' then begin
    : : : : : ShowMessage('Invalid password! Terminating program');
    : : : : : Close; // Close program
    : : : : : end;
    : : : : : Form2.Free; // Free memory
    : : : : : end;
    : : : : : [/code]
    : : : : : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    : : : : :
    : : : :
    : : : :
    : : : :
    : : : : ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    : : : : i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
    : : : :
    : : : I see. Here is the code for the OnClick() event of the button. This will check the validity of the password and then show the second form.
    : : : [code]
    : : : procedure TForm1.Button1Click(Sender: TObject);
    : : : begin
    : : : if Edit1.Text='Password' then
    : : : Form2.ShowModal;
    : : : end;
    : : : [/code]
    : : :
    : : :
    : : thanks! now all i need is to know how to make the message box pop up if the password is wrong??
    : : do i put this code:
    : :
    : : if Edit1.Text= ('') then
    : : ShowMessage ('Password Invalid')
    : :
    : : do i put that after your code?
    : : thanks!
    : : do i put it after
    : :
    : Add an else statement to the it-then. Something like this:
    : [code]
    : : : if Edit1.Text='Password' then
    : : : Form2.ShowModal
    : else
    : ShowMessage('Password Invalid');
    : [/code]
    :
    :
    :
    thanks alot!! that helped so much!
  • : [b][red]This message was edited by the zibadian at 2002-5-26 23:13:32[/red][/b][hr]
    : : : : : : : : : [b][red]This message was edited by the zibadian at 2002-5-24 6:2:17[/red][/b][hr]
    : : : : : : : : : : how do i make an about form that wil scroll like a "credits" look. i want to make it scroll. please help and use laymans terms cuz im very new to delphi. thanks!
    : : : : : : : : : :
    : : : : : : : : : The easiest way is to place a 2 TMemos and a TTimer on the form. 1 Memo has its Visible property set to false, and contains all the credits lines. The other one is the "credits-view". In the OnTimer, you delete the top line from the credits-view and copy a new line to the view from the hidden memo. Here is a small piece of untested code, which shows what I mean.
    : : : : : : : : : [code]
    : : : : : : : : : procedure TForm1.Timer1Timer(Sender: TObject);
    : : : : : : : : : begin
    : : : : : : : : : Memo1.Lines.Delete(0); // Delete the top line
    : : : : : : : : : Memo1.Lines.Add(Memo2.Lines[Timer1.Tag]); // Add the new line to the bottom
    : : : : : : : : : Timer1.Tag := Timer1.Tag + 1; // Increase the counter to the next line
    : : : : : : : : : if Timer1.Tag = Memo2.Lines.Count then
    : : : : : : : : : Timer1.Tag := 0; // Start from the beginning again.
    : : : : : : : : : end;
    : : : : : : : : : [/code]
    : : : : : : : : :
    : : : : : : : : :
    : : : : : : : : :
    : : : : : : : : ok, i kind of got it but im not to familiar with timers. please emphasize on the timer explanation if you can explain the reason for the commands u put in, i would greatly appreciate it ! thanks for your help!
    : : : : : : : :
    : : : : : : : A TTimer is simply a component, which performs an action once per interval. The length of the interval can be set by you in the Object Inspector or at run-time. The action it performs is gives in the OnTimer event. For more explanation, please refer to the help files.
    : : : : : : :
    : : : : : :
    : : : : : :
    : : : : : : ok that helps allot thanks,but im tryin to do something, i wanna make a password program that when u type in the right password and click on a button u will be displayed a form. and if you get it wrong, then it will display a message, please help, i know its easy to do but i cant remember how. thanks!
    : : : : : :
    : : : : : The following code needs some work. It takes a TEdit on an extra form. This form needs to be removed from the auto-create list in the Program|Options dialog box.
    : : : : : [code]
    : : : : : procedure TForm1.FormCreate(Sender: TObject);
    : : : : : begin
    : : : : : Form2:=TForm.Create(Application); // Create the password form
    : : : : : Form2.ShowModal; // show it
    : : : : : if Form2.Edit1<>'password' then begin
    : : : : : ShowMessage('Invalid password! Terminating program');
    : : : : : Close; // Close program
    : : : : : end;
    : : : : : Form2.Free; // Free memory
    : : : : : end;
    : : : : : [/code]
    : : : : : This will ask for a password, before the mainform shows. If the user types the correct password then the program proceeds, otherwise it terminates.
    : : : : :
    : : : :
    : : : :
    : : : :
    : : : : ok thanks but that kind of not what i meant. i meant that i want my main form to have an edit box on it that when somebody types something in there and clicks on a button, then depending on if the password is right they will see another form.
    : : : : i made one similiar but i didnt have a button and as soon as the text was typed then the form was shown. i want the user to click a button first. thanks!
    : : : :
    : : : I see. Here is the code for the OnClick() event of the button. This will check the validity of the password and then show the second form.
    : : : [code]
    : : : procedure TForm1.Button1Click(Sender: TObject);
    : : : begin
    : : : if Edit1.Text='Password' then
    : : : Form2.ShowModal;
    : : : end;
    : : : [/code]
    : : :
    : : :
    : : thanks! now all i need is to know how to make the message box pop up if the password is wrong??
    : : do i put this code:
    : :
    : : if Edit1.Text= ('') then
    : : ShowMessage ('Password Invalid')
    : :
    : : do i put that after your code?
    : : thanks!
    : : do i put it after
    : :
    : Add an else statement to the it-then. Something like this:
    : [code]
    : : : if Edit1.Text='Password' then
    : : : Form2.ShowModal
    : else
    : ShowMessage('Password Invalid');
    : [/code]
    :
    :
    :
    thanks alot!! that helped so much!
Sign In or Register to comment.

Howdy, Stranger!

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

Categories