Home > Back-end >  Prompt box after the prompt, after point to determine how to make the code is no longer running
Prompt box after the prompt, after point to determine how to make the code is no longer running

Time:04-21

Form there is a two Page, Form open, page1 will show, page2 will hide, some new, page1 will hide, page2 will show up, the save, do data validation, prompt should stay after page2, results page2 hide, page1 will show out
Below is the interface
Page1

Page2


And then the validation code
The first paragraph
//save processing 
Procedure SysMethodFromKeep (Sender: TObject);
The begin
//check processing
SysFormevent. SysFormeventCheck (Sender);
//new state
If Man. InUp='IN' then
The begin
//basic data type
If the Copy (TForm (the Sender). UnitName, 1, 1)='U' then
The begin
SysMethodFromUIn (Sender)
end;
//type of document
If the Copy (TForm (the Sender). UnitName, 1, 1)='Z' then
The begin
SysMethodFromZIn (Sender)
end;
End
//update state
Else if Man. InUp='UP' then
The begin
//basic data type
If the Copy (TForm (the Sender). UnitName, 1, 1)='U' then
The begin
SysMethodFromUUp (Sender)
end;
//type of document
If the Copy (TForm (the Sender). UnitName, 1, 1)='Z' then
The begin
//SysMethodFromZUp (Sender)
end;

end;

end;


The second tip section
 else if TForm (Sender). The Components [I] is TDBLookupComboboxEh then 
The begin
If TDBLookupComboboxEh (TForm (the Sender). The Components [I]). The Name=TableID then
The begin
If Man. FDQuery1. FieldByName (" CheckType "). AsString='is not empty then
The begin
If TDBLookupComboboxEh (TForm (the Sender). The Components [I]). The Text="' then
The begin
Error:=Man. FDQuery1. FieldByName (' TableName). AsString + 'can't be empty.
MessageBox (0, PWCHAR (Error), 'warning' MB_OKCANCEL);
exit;
End
End
End
End

Tried several can't prompt box type, determine a cancelled, have tried or not character, then point to identify and cancel nuzzling page1

CodePudding user response:

 procedure TSysFormevent. SysFormeventCheck (Sender: TObject); 
Var
I: Integer;
J: Integer;
FDQuery: TFDQuery;
FDQueryItem: TFDQuery;
DBGridEh: TDBGridEh;
DBGridEhItem: TDBGridEh;
TableID: String;
TableItemID: String;
MemTableEh: TMemTableEh;
FDMemTable: TFDMemTable;
Error: String;
RepeatName: String;
The begin
//control initialization
FDQuery:=nil;
FDQueryItem:=nil;
MemTableEh:=nil;
FDMemTable:=nil;
RepeatName:=';
Man. FDQuery1. Close;
Man. FDQuery1. SQL. The Clear;
Man. FDQuery1. SQL. Add (' select * from t_Formcheck where ModID='" +
Man. ChilFormTable + "' or ModID='" + Man. ChilFormTable +' Item ' ' ');
Man. FDQuery1. Open;
While not Man. FDQuery1. Eof do
The begin
For I:=0 to TForm (Sender). Do ComponentCount - 1
The begin
TableID:=Man. FDQuery1. FieldByName (" TableID "). AsString;

If TForm (Sender). The Components [I] is TEdit then
The begin
If TEdit (TForm (the Sender). The Components [I]). The Name=TableID then
The begin
If Man. FDQuery1. FieldByName (" CheckType "). AsString='is not empty then
The begin
If TEdit (TForm (the Sender). The Components [I]). The Text="' then
The begin
Error:=Man. FDQuery1. FieldByName (' TableName). AsString + 'can't be empty.
//MessageDlg (' this is MessageDlg message box, mtCustom, [mbOK], 0).
MessageBox (0, PWCHAR (Error), 'warning' MB_ABORTRETRYIGNORE);
exit;
End
End
End
End
Else if TForm (Sender). The Components [I] is TComboBox then
The begin
If TComboBox (TForm (the Sender). The Components [I]). The Name=TableID then
The begin
If Man. FDQuery1. FieldByName (" CheckType "). AsString='is not empty then
The begin
If TComboBox (TForm (the Sender). The Components [I]). The Text="' then
The begin
Error:=Man. FDQuery1. FieldByName (' TableName). AsString + 'can't be empty.
MessageBox (0, PWCHAR (Error), 'warning' MB_ICONEXCLAMATION);
exit;
End
End
End
End
Else if TForm (Sender). The Components [I] is TDBLookupComboboxEh then
The begin
If TDBLookupComboboxEh (TForm (the Sender). The Components [I]). The Name=TableID then
The begin
If Man. FDQuery1. FieldByName (" CheckType "). AsString='is not empty then
The begin
If TDBLookupComboboxEh (TForm (the Sender). The Components [I]). The Text="' then
The begin
Error:=Man. FDQuery1. FieldByName (' TableName). AsString + 'can't be empty.
MessageBox (0, PWCHAR (Error), 'warning' MB_OKCANCEL);
exit;
End
End
End
End
Else if (TForm (the Sender). The Components [I] is TDBGridEh) then
The begin
If TDBGridEh (TForm (the Sender). The Components [I]). The Name='DBGridEhBJ' then
The begin
TDBGridEh (TForm (the Sender). The Components [I]). The DataSource. The DataSet. The First;
While the not TDBGridEh (TForm (the Sender). The Components [I]). The Eof do
the DataSource. The DataSet.The begin
For j:=0 to TDBGridEh (TForm (Sender). The Components [I]). Do FieldCount - 1
The begin
If TDBGridEh (TForm (the Sender). The Components [I]). The Fields [j]. J FullName=TableID then
The begin
If Man. FDQuery1. FieldByName (" CheckType "). AsString='is not empty then
The begin
If TDBGridEh (TForm (the Sender). The Components [I]). The DataSource. The DataSet. FieldByName (TableID). AsString="' then
The begin
Error:=Man. FDQuery1. FieldByName (' TableName). AsString + 'can't be empty.
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related