procedure ShowNormalForm(FormClass: TBaseFormClass; ParentFrom: TForm; FunctionName: string; var Form: TForm); begin if CheckRunForm(FunctionName) then //检查权限 begin if not Assigned(Form) then Form := FormClass.CreateWithFunction(ParentFrom,FunctionName); Form.Show; end else application.MessageBox('您无权对此项进行操作!','警告',64); end;
function CheckRunForm(FunctionName: string): Boolean; begin Result := False; with Frmdata.spUserRight do if Locate('FunctionName',FunctionName,[]) then begin if FieldByName('fAll').AsBoolean then Result := True else if FieldByName('fRead').AsBoolean then Result := True ; end; end;
订单窗体TORCustOrderfrm中有关闭窗体时设为空 procedure TORCustOrderfrm.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; ORCustOrderfrm:=nil; end;