summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-11-12 16:57:50 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-11-12 16:57:50 +0200
commitdd64b15727ea9632419ddfc025d97a2f2ef7f119 (patch)
tree1af556bbce5e09354319ec76c25e7831d4b5bbb0 /extras
parente7537ec8f30dae63283fffdb70c239060b780c0b (diff)
downloadfpGUI-dd64b15727ea9632419ddfc025d97a2f2ef7f119.tar.xz
Implemented tiProcessing() and tiEndProcessing which displays a type of
notification window. Very usefully for long running tasks and when you don't have a statusbar like in the case of SDI style applications.
Diffstat (limited to 'extras')
-rw-r--r--extras/tiopf/gui/tiDialogs.pas80
1 files changed, 80 insertions, 0 deletions
diff --git a/extras/tiopf/gui/tiDialogs.pas b/extras/tiopf/gui/tiDialogs.pas
index fe75a749..6fe36bf4 100644
--- a/extras/tiopf/gui/tiDialogs.pas
+++ b/extras/tiopf/gui/tiDialogs.pas
@@ -37,6 +37,9 @@ uses
// Show a error message
procedure tiAppError(const AMessage: string; ATitle: string = '');
+ // A type of notification window that will disappear by it self
+ procedure tiProcessing(const AMessage: TfpgString);
+ procedure tiEndProcessing;
implementation
@@ -44,10 +47,67 @@ uses
fpg_main,
fpg_form,
fpg_memo,
+ fpg_label,
fpg_dialogs,
+ fpg_panel,
tiGUIINI,
tiUtils;
+var
+ pWorkingForm: TfpgForm;
+
+type
+ TProcessingForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: ProcessingForm}
+ Bevel1: TfpgBevel;
+ lblMessage: TfpgLabel;
+ {@VFD_HEAD_END: ProcessingForm}
+ public
+ procedure AfterCreate; override;
+ end;
+
+{ TProcessingForm }
+
+procedure TProcessingForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: ProcessingForm}
+ Name := 'ProcessingForm';
+ SetPosition(317, 177, 400, 150);
+ WindowTitle := 'Processing...';
+ WindowPosition := wpScreenCenter;
+ BackgroundColor := clHilite1;
+ WindowType := wtPopup;
+
+ Bevel1 := TfpgBevel.Create(self);
+ with Bevel1 do
+ begin
+ Name := 'Bevel1';
+ SetPosition(8, 4, 232, 80);
+ Align := alClient;
+ end;
+
+ lblMessage := TfpgLabel.Create(Bevel1);
+ with lblMessage do
+ begin
+ Name := 'lblMessage';
+ SetPosition(32, 28, 108, 32);
+ Alignment := taCenter;
+ FontDesc := '#Label1';
+ Hint := '';
+ Layout := tlCenter;
+ Text := '...';
+ WrapText := True;
+ Align := alClient;
+ MouseCursor := mcHourGlass;
+ end;
+
+ {@VFD_BODY_END: ProcessingForm}
+ {%endregion}
+end;
+
+
procedure tiShowMessage(const AArray: array of const);
const
@@ -175,5 +235,25 @@ begin
TfpgMessageDialog.Critical(ATitle, AMessage);
end;
+procedure tiProcessing(const AMessage: TfpgString);
+begin
+ if not Assigned(pWorkingForm) then
+ begin
+ pWorkingForm := TProcessingForm.Create(nil);
+ TProcessingForm(pWorkingForm).lblMessage.Text := AMessage;
+ pWorkingForm.Show;
+ end
+ else
+ TProcessingForm(pWorkingForm).lblMessage.Text := AMessage;
+ fpgApplication.ProcessMessages;
+end;
+
+procedure tiEndProcessing;
+begin
+ if Assigned(pWorkingForm) then
+ pWorkingForm.Close;
+ FreeAndNil(pWorkingForm);
+end;
+
end.