Jump to content


Photo

"MessageScreen" - Blocking(!) Message- and InputDialogs and "Live" StatusMessages (with Abort option)

MessageDlgInputDlg ShowMessage Modal; Blocking; Status Messages callback abort

  • Please log in to reply
6 replies to this topic

#1 Oliver Morsch

Oliver Morsch

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 191 posts
  • LocationGermany

Posted 22 September 2015 - 01:40 AM

"MessageScreen" - Blocking(!) Message- and InputDialogs and "Live" StatusMessages (with Abort option)
 
No need for callbacks or extra threads or ...
 
- Live Status messages (show the user at every time, what you are just doing)
 
- Blocking(!) Input Dialog
 
- Blocking(!) Message Dialog
 
- "Abort option" at every time
 
Sample Code:
 
procedure TfrmMain.btnTestClick(Sender: TObject);
var
  Nam: String;
  i: Integer;
  Br: Boolean;
begin
  MS.Show;
  try
 
    // "Live" Status Messages:
    MS.StatusMsg('Step 1 / 3 ...');
    Sleep(4000); // Do Something here ...
    MS.StatusMsg('Step 2 / 3 ...');
    Sleep(4000); // Do Something here ...
    MS.StatusMsg('Step 3 / 3 ...');
    Sleep(4000); // Do Something here ...
 
    // Input Dialog:
    if MS.InputDlg('Please enter your name:', 'Bill', 50) = 1 then begin
      Nam := MS.LastAnswerVal;
      MS.MessageDlg('Your name is ' + Nam + '!', 'OK');
    end;
 
    // Message Dialog:
    case MS.MessageDlg('What do you want to do today, ' + Nam + '?', 'Do This', 'Do That', 'Do Everything', 'Do Anything' , 'Do Nothing') of
      1: MS.MessageDlg('You Pressed Button 1!', 'OK');
      2: MS.MessageDlg('You Pressed Button 2!', 'OK');
      3: MS.MessageDlg('You Pressed Button 3!', 'OK');
      4: MS.MessageDlg('You Pressed Button 4!', 'OK');
      5: MS.MessageDlg('You Pressed Button 5!', 'OK');
    else
      raise Exception.Create('There is no other Button, only 1 - 5 ?!');
    end;
 
    // "Live" Status Messages with "ABORT" option:
    Br := False;
    for i := 1  to 10000000 do begin
      MS.StatusMsg('Record ' + IntToStr(i) + ' / 10000000', 1000, True); // !!! Important: Use "Delay" (here 1000 ms) if there are many Updates per second !!!
      if MS.HasAbort then begin
        if MS.MessageDlg('Really ABORT ?', 'Yes', 'No') = 1 then begin
          Br := True;
          BREAK;
        end;
      end;
    end;
    if Br then begin
      MS.MessageDlg('User has pressed ABORT !', 'OK');
    end;
    MS.StatusMsg('Ready!');
    Sleep(2000);
 
  finally
    MS.Hide;
  end;
end;
 

Attached Files


  • 3

#2 Alberto vesx

Alberto vesx

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 451 posts

Posted 22 September 2015 - 04:49 PM

Thank you


  • 0

#3 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9354 posts

Posted 23 September 2015 - 04:24 PM

I didnt have time to look at this, but from its description it looks like that it introduces cool features.

I will test it soon.

Thanks for sharing.
  • 0

#4 wxb_km

wxb_km

    Active Member

  • Members
  • PipPipPip
  • 98 posts

Posted 02 November 2015 - 01:52 PM

Good!very useful!
  • 0

#5 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9354 posts

Posted 26 November 2015 - 01:01 PM

You handle HTTP requests in background which originate from a HTML frame.

Very smart!

 

Perhaps we can extend and integrate a similar method in uniGUI core.

 

Thanks again


  • 2

#6 Oliver Morsch

Oliver Morsch

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 191 posts
  • LocationGermany

Posted 26 November 2015 - 02:02 PM

Perhaps we can extend and integrate a similar method in uniGUI core.

 

That would be great!


  • 0

#7 mohammad

mohammad

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 557 posts
  • LocationKufur Kassem, Palestine

Posted 26 December 2016 - 06:56 AM

+1


  • 0





Also tagged with one or more of these keywords: MessageDlgInputDlg, ShowMessage, Modal;, Blocking;, Status Messages, callback, abort

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users