Jump to content

Ronak

Members
  • Posts

    123
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Ronak

  1. http://forums.unigui.com/index.php?/topic/2068-tunidbgrid/page__p__9177__hl__title__fromsearch__1#entry9177 Uses tag <br> Sample: hello<br>word DisplayLabel/Title hello<br>word
  2. Ronak

    dbDemo

    Simple Db Demo Application ProjDbDemo.rar
  3. Dear Farshad, Sorry for delay, I was having leave for 4 days... Demo re-uploaded. Regards
  4. Hello, for sending the attachment the file have to be uploaded to server first and then add to the mail attachments. consider report.fr3 files as selecting layouts for your mails, may create a pick-list of fr3 layouts. Here is one Demo/Mess showing selecting Layout, Mail-Merge, compose mails with attachment and finally send mail Regards EMails.rar
  5. Ronak

    Send file (PDF)

    http://forums.unigui.com/index.php?/topic/2669-fastreport-demo/
  6. Ronak

    HowTo : send mail

    Hello, Try, Creating the AddEmail Active-X object at run time and the set the required property values instead of dropping the component on the form at design time. Regards
  7. Ronak

    Send file (PDF)

    UniSession.SendFile(UniServerModule.LocalCachePath +fn, fn);
  8. Simple Demo project for fastreport Original demo contains a design flaw. See here. I added a revised demo. Farshad Demo_FastReport.rar Demo_FastReport_corrected.rar
  9. Simply select icon for the application only. D2009> Project > options > application icon forms Icon, keep it <none>, nothing to do. works fine for me. no issue.
  10. Ronak

    HowTo : send mail

    Hi, Compose the mail and store to database, once the mail is ready to be send, call the mail sender, see the code unit MailsForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIForm, StrUtils, IdCoderMIME, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdMessage, IdAttachment, IdAttachmentFile, IdText, DB, ADODB, uniGUIBaseClasses, uniButton; type TFormMails = class(TUniForm) QryMain: TADOQuery; QryMainEmailId: TAutoIncField; QryMainFolder: TIntegerField; QryMainTagIO: TStringField; QryMainRefDate: TDateTimeField; QryMainSize: TIntegerField; QryMainFromEmail: TMemoField; QryMainToEmail: TMemoField; QryMainCCEmail: TMemoField; QryMainBCCEmail: TMemoField; QryMainSubject: TMemoField; QryMainBody: TMemoField; QryMainRawMsg: TBlobField; QryMainIsSubmitted: TBooleanField; QryMainIsSent: TBooleanField; QryMainSentDate: TDateTimeField; QryMainUsersId: TIntegerField; QryMainIsReaded: TBooleanField; QryMainMainId: TAutoIncField; QryMainTndrId: TIntegerField; QryDetailA: TADOQuery; QryDetailAEmailDetId: TAutoIncField; QryDetailAEmailId: TIntegerField; QryDetailAAtchFileName: TStringField; QryDetailAAtchFileData: TBlobField; QryDetailAAtchSize: TIntegerField; QryDetailAMainId: TIntegerField; ButtonSendMail: TUniButton; procedure ButtonSendMailClick(Sender: TObject); private procedure SendHtmlMail; procedure ProcessHtml(var HBody: WideString; AtchList: TStringList); procedure Decode2File(const base64: String; const FileName: string); function MyBase64Decode(const EncodedText: string): TBytes; { Private declarations } public { Public declarations } end; implementation uses uniGUIApplication, ServerModule, MainModule; {$R *.dfm} { TUniForm1 } procedure TFormMails.ButtonSendMailClick(Sender: TObject); begin if not (QryMain.State in [dsInsert,dsEdit]) then QryMain.Edit; QryMainIsSubmitted.Value:=True; QryMain.Post; if (not QryMainIsSent.AsBoolean) and (QryMainIsSubmitted.AsBoolean) then SendHtmlMail(); end; procedure TFormMails.Decode2File(const base64, FileName: string); var stream: TFileStream; bytes: TBytes; begin bytes := MyBase64Decode(base64); stream := TFileStream.Create(FileName, fmCreate); try if bytes<>nil then stream.Write(bytes[0], Length(Bytes)); finally stream.Free; end; end; function TFormMails.MyBase64Decode(const EncodedText: string): TBytes; var DecodedStm: TBytesStream; Decoder: TIdDecoderMIME; begin Decoder := TIdDecoderMIME.Create(nil); try DecodedStm := TBytesStream.Create; try Decoder.DecodeBegin(DecodedStm); Decoder.Decode(EncodedText); Decoder.DecodeEnd; Result := DecodedStm.Bytes; SetLength(Result, DecodedStm.Size); finally DecodedStm.Free; end; finally Decoder.Free; end; end; procedure TFormMails.ProcessHtml(var HBody: WideString; AtchList: TStringList); var sHtm,sBase: WideString; i,iCid,iPart,klen: integer; sKey,TmpAtchfile: String; bSkip:Boolean; begin AtchList.Clear; sHtm := QryMainBody.AsString; sKey := '<img src="data:'; klen := length(sKey); bSkip:= False; iCid := 0; HBody:= ''; sBase:= ''; iPart:= 1; for i:=1 to Length(sHtm) do begin if iPart=1 then HBody:=HBody +sHtm[i] else if iPart=2 then begin if not bSkip then sBase:=sBase +sHtm[i]; if (RightStr(sBase,7)= 'base64,') then sBase:=''; if (RightStr(sBase,6)= '" alt=') then begin SetLength(sBase,length(sBase)-6); bSkip:=True; end; end; if (iPart=1) and (RightStr(HBody, klen)=sKey) then iPart:=2 else if (iPart=2) and (sHtm[i]='>') then begin iPart:=1; bSkip:=False; SetLength(HBody, length(HBody)-5); HBody := HBody +'cid:ImgID' +InttoStr(iCid) +'">'; TmpAtchfile := UniServerModule.LocalCachePath +'Tmp'+InttoStr(iCid); Decode2File(sBase, pchar(TmpAtchfile)); sBase:=''; AtchList.Add(TmpAtchfile); iCid:=iCid+1; end; end; end; procedure TFormMails.SendHtmlMail; var i:Integer; HtmPart, TxtPart: TIdText; BmpPart: TIdAttachment; Msg: TIdMessage; IdSMTP: TIdSMTP; AtchFile, sSql: String; sHBody: WideString; AtchList: TStringList; begin sHBody:=''; AtchList:= TStringList.Create; ProcessHtml(sHBody, AtchList); Msg := TIdMessage.Create(nil); Msg.From.address := QryMainFromEmail.AsString; Msg.Recipients.EMailAddresses := QryMainToEmail.AsString; Msg.CCList.EMailAddresses := QryMainCCEmail.AsString; Msg.BccList.EMailAddresses := QryMainBCCEmail.AsString; Msg.Subject := QryMainSubject.AsString; Msg.ContentType := 'multipart/alternative'; TxtPart := TIdText.Create(Msg.MessageParts); TxtPart.ContentType := 'text/plain'; TxtPart := TIdText.Create(Msg.MessageParts); TxtPart.ContentType := 'multipart/related; type="text/html"'; HtmPart := TIdText.Create(Msg.MessageParts, nil); HtmPart.ContentType := 'text/html'; HtmPart.Body.Add('<html>'); HtmPart.Body.Add('<head>'); HtmPart.Body.Add('</head>'); HtmPart.Body.Add('<body>'); HtmPart.Body.Add(sHBody); HtmPart.Body.Add('</body>'); HtmPart.Body.Add('</html>'); HtmPart.ParentPart := 1; for i:=0 to AtchList.Count-1 do begin BmpPart := TIdAttachmentFile.Create(Msg.MessageParts, pchar(AtchList[i])); BmpPart.ContentType := 'image/jpeg'; BmpPart.ContentDisposition := 'inline'; BmpPart.ContentID := 'ImgID'+ IntToStr(i); BmpPart.ParentPart := 1; end; Msg.ContentType := 'multipart/mixed'; QryDetailA.First; while not QryDetailA.Eof do begin AtchFile := UniServerModule.LocalCachePath +QryDetailAAtchFileName.AsString; QryDetailAAtchFileData.SaveToFile(PChar(AtchFile)); TIdAttachmentFile.Create(Msg.MessageParts, AtchFile); QryDetailA.Next; end; IdSMTP := TIdSMTP.Create(nil); with UniMainModule do begin idSMTP.Username := QryFirmSmtpUser.AsString; idSMTP.Password := QryFirmSmtpPw.AsString; idSMTP.Host := QryFirmSmtpHost.AsString; idSMTP.Port := QryFirmSmtpPort.AsInteger; end; try idSMTP.Connect(); try idSMTP.Send(Msg); sSql:= 'UPDATE Email SET Folder = 1, IsSent = 1, SentDate = GETDATE() WHERE (EmailId=0'; sSql:= sSql +QryMainMainId.AsString +')'; UniMainModule.Conn.Execute(Pchar(sSql)); ShowMessage('Message Sent'); except on E: Exception do ShowMessage('Failed: ' + E.Message); end; finally if IdSMTP.Connected then idSMTP.Disconnect(); Msg.Free; IdSMTP.Free; AtchList.Clear; AtchList.Free; end; end; end. TestEMails.rar TestRetriveMails.rar
  11. Ronak

    Dynamic menu

    Hi, This may help, see the demo Regards ProjMenu.rar
  12. Application form will be created automatically when required or when you just say UniForm1.Show you need not to create it.
  13. A demo using Calculated field and Remote Query ComboVlist.rar RemoteLookup.rar
  14. BeforeEdit Even will work, try procedure TForm1.QryMainBeforeEdit(DataSet: TDataSet) begin if QryMainColor.AsString<>'Green' then Abort; end;
  15. Yes, This code helped Thanks
  16. Hello, Are you loading all the records of lookup information queries? try to load single record of lookup information queries, see my demo project, if applicable... Regards Lookup.rar
  17. Hello, In UniComboBox, when I set the text of an UniComboBox using button click, UniComboBox1.Text:='Malvinas'; Once popup list will show the records Like % 'Malvinas', Ok fine now, again re-set the text using button click, UniComboBox1.Text:='United'; popup list is still showing the records related to 'Malvinas', expected to show records Like % 'Malvinas'. How can I instruct UniComboBox to re-execute remote query? procedure TMainForm.UniButton1Click(Sender: TObject); begin UniComboBox1.Text:='Malvinas'; end; procedure TMainForm.UniButton2Click(Sender: TObject); begin UniComboBox1.Text:='United'; end; procedure TMainForm.UniComboBox1RemoteQuery(const QueryString: string; Result: TStrings); var I: Integer; s: String; begin if Trim(QueryString)='' then s:=UniComboBox1.Text else s:=QueryString; if Trim(s)='' then Exit; ClientDataSet1.Filter:='country LIKE ''%'+ s+'%'''; ClientDataSet1.First; while not ClientDataSet1.Eof do begin Result.Add(ClientDataSet1.FieldByName('country').AsString); ClientDataSet1.Next; end; end;
  18. Hi, when MainformdisplayMode is mfPage and some other form's FormStyle is fsMDIChild, I get Ajex Error e.floatParent.getTargetEl(...) is undefined when MainformdisplayMode is mfPage and some other form's FormStyle is fsNormal or fsStayOnTop No error Does this mean not to use fsMDIChild form? or some other setting is missed? Regards
  19. Hello, How can I Hide/Unhide Menu of MainForm MainForm.Menu :=nil // not working http://delphi.about.com/od/delphitips2007/qt/mainmenuhide.htm Regards
  20. Ronak

    Menu in a Frame

    Hi, Is there any way to have menu on frame? I was used to have TToolBar in frame and TToolBar has menu property, but TUniToolBar don't have Menu property. Regards
  21. Yes you are correct, Issue with Groupbox. Using panel can be alternative. Thanks
  22. I checked wih build 973, I could not see any issue like shown above...., May check with new/fresh project. regards
  23. I checked wih build 973, I could not see any issue like shown above.... may check with new/fresh project. regards
×
×
  • Create New...