Recent

Author Topic: need assistance - overlay message that shows on top and closes  (Read 7930 times)

nesa24

  • New member
  • *
  • Posts: 8
Hello,
i need assistance how to create exe that displays a message on top of all programs and closes it 3s after message is displayed.
Can someone assist me ?


Best regards
keep open sourcing

Imants

  • Full Member
  • ***
  • Posts: 196
Re: need assistance - overlay message that shows on top and closes
« Reply #1 on: April 29, 2010, 10:15:41 am »
I think it would be something like this:


unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, ExtCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    btOk: TButton;
    lblMessage: TLabel;
    tmClose: TTimer;
    procedure tmCloseTimer(Sender: TObject);
  private
    { private declarations }
  public
    class Procedure ShowMessage(aMessage: string);
  end;

var
  Form1: TForm1;

implementation

procedure TForm1.tmCloseTimer(Sender: TObject);
begin
  ModalResult := mrOK;
end;

{$R *.lfm}

{ TForm1 }

class procedure TForm1.ShowMessage(aMessage: string);
begin
  with TForm1.Create(nil) do
  try
    FormStyle := fsStayOnTop;
    lblMessage.Caption := aMessage;
    tmClose.Enabled := True;
    ShowModal;
  finally
    Free
  end;
end;

end.

I put uo timer with interval 3000 which close form after time runs out

nesa24

  • New member
  • *
  • Posts: 8
Re: need assistance - overlay message that shows on top and closes
« Reply #2 on: April 30, 2010, 08:37:53 pm »
hello,
thank you for example but i am getting errors when i want to run
I have created form/timer/button/label

can someone assist me with this issue  :o

best regards

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: need assistance - overlay message that shows on top and closes
« Reply #3 on: April 30, 2010, 10:39:09 pm »
Code: [Select]
procedure TForm1.Timer1Timer(Sender:TObject);
begin
  bringtofront;
end; 

With FormStyle as fsStayOnTop.
« Last Edit: April 30, 2010, 10:41:38 pm by typo »

Imants

  • Full Member
  • ***
  • Posts: 196
Re: need assistance - overlay message that shows on top and closes
« Reply #4 on: May 01, 2010, 08:28:10 am »
hello,
thank you for example but i am getting errors when i want to run
I have created form/timer/button/label

can someone assist me with this issue  :o

best regards

What kind of error do you get?

nesa24

  • New member
  • *
  • Posts: 8
Re: need assistance - overlay message that shows on top and closes
« Reply #5 on: May 01, 2010, 02:54:09 pm »
Thanks for interest. Will try this weekend when i have time and post errors.
Best regards to all

nesa24

  • New member
  • *
  • Posts: 8
Re: need assistance - overlay message that shows on top and closes
« Reply #6 on: May 03, 2010, 10:12:27 am »
Errors are
Parameter Sender not used
and
Error while linking

i created timer and message form
can someone assist me?
best regards

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: need assistance - overlay message that shows on top and closes
« Reply #7 on: May 04, 2010, 04:13:01 am »
Quote
Parameter Sender not used
It's not an error, just a hint. Usually an indication of useless parameter, but not always.
Quote
Error while linking
Where did you save your project?

nesa24

  • New member
  • *
  • Posts: 8
Re: need assistance - overlay message that shows on top and closes
« Reply #8 on: May 04, 2010, 06:35:19 am »
yes i did save project.
can someone make project and attach it so i could see where i am making mistakes?

Best regards to all

Imants

  • Full Member
  • ***
  • Posts: 196
Re: need assistance - overlay message that shows on top and closes
« Reply #9 on: May 05, 2010, 06:31:32 am »
Here is example project.
I takes two params(one for messge one for title)

 

TinyPortal © 2005-2018