Jump to content

SergioFeitoza

uniGUI Subscriber
  • Posts

    301
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SergioFeitoza

  1. Hi friends. Can anyone suggest me a book to get or to buy where I can study to understand dep the Java Script language. I want, for example, to know how these phrases are formed, to know about Ajax events and even about how to do animations with Java Script. I thank you in advance. My first need is to understand how to save, in a desired directory, as pdf a PrintScrenn / snap shot of a page. I could read a lot of examples in the forum but I do not know sufficiently to understand them. For example , how to implment something equivalent to the Function ScreenShot below? If it is not permitted to post names of books in the forum please write to my email sergiofeitozacosta@gmail.com Thanks in advance function screenshot(){ html2canvas(document.querySelector("#capture")).then( canvas => { var a = document.createElement('a'); a.href = canvas.toDataURL("image/jpeg",1.0).replace("image/jpeg", "image/octet-stream"); a.download = 'somefilename.jpg'; a.click(); }); } with UniButton1 do JSInterface.JSCode('html2canvas(document.querySelector("#' + JSId +'")).then(function(canvas) {ajaxRequest('#1', "getData", ["base64Data="+canvas.toDataURL()])});'); procedure TMainForm.UniButton1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='getData' then begin // Params.Values['base64Data'] // Here you need to decode the Base64 string // data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAZ...AAAABJRU5ErkJggg== end; end; function canvasSaveAs(uri, filename) { var link = document.createElement('a'); if (typeof link.download === 'string') { link.href = uri; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); } else { window.open(uri); } } fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); UniPanel1.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ UniPanel1.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' );
  2. Hi Sherzod This is one of the good posts I went through before writing. However even after running the code above I remained with these basic doubts: 1) If I replace the name of a component to snapshot by "MainForm" it does not compile. The many components of my main page are not in a single container. So I need a printscreen of the whole page.. . What should I do ? 2) I do not understand yet in which directory the screenshot is saved. I checked the directory ... FILES but was not there. I included Files in the ervermodule.customfiles How to write the code below to save the screenshot in the ...Files directory? 3) What should I write to save the screenshot as jpeg ?
  3. Hi Sherzod I followed your suggestion and worked in it. I could run the code below without errors but do not know where the screenshot was saved (no visualization cames).. Unfortunately my code is very big to post here and be understood. . My intention is to SAVE a printscreen of the complete page (pdf or jpg or png ) and after to send it by e-mail. I need to screenshot the whole page and not just a component of the page as in the code below (the tunipanel named pnlTSaccount ) I need to screenshot like is done here https://html2canvas.hertzen.com/ (Click button TRYOUT and after button CAPTURE) I know how to send by email if I know the directory where the screenshot was saved. I have 3 doubts. 1) If I replace the the panel pnlTSaccount of the code below by "MainForm" it does not compile. The many components of my main page are not in a single container. So I need a printscreen of the whole page.. . What should I do ? 2) I do not understand yet in which directory the screenshot is saved. I checked the directory ... FILES but was not there. I included Files in the ervermodule.customfiles How to write the code below to save the screenshot in the ...Files directory? 3) What should I write in the text below to save the screenshot as jpeg ? ------------------------------------ procedure TMainForm.ReportViaEmailClick(Sender: TObject); var fName: string; begin fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); pnlTSaccount.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ pnltopmain.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' ); ///// UniMainModule.SMTPSEND(LOGIN, USERNAME,'REPORT'); ///// SMTPSEND SMTPSEND ///// showMessage(' Check your e-mail inbox. This page is attached to an e-mail'); end
  4. Thanks Sherzod Looks great Tomorrow I will try with it
  5. When I am running my code I need to save as jpeg or pdf a screenshot of that page. I found the sample \FMSoft\Framework\uniGUI\Demos\Desktop\HTML2Image that seems to do more or less what I need As written in the demo it is necessary to install an external tool downloadable in from https://wkhtmltopdf.org/ and install it. My question is : is there any resource available which does not request to install the external tool ? Thanks in advance
  6. Thank you Ron for all the great help After some days I could implement and evething is working. Next Days I will post the link for accessing here during a free experimental period . Lets see how will move
  7. Thanks You gave me a great help and now I can do something understanding better how the log files are generated Regards
  8. Maybe something including the Logger Property TUniGUIServerModule.Logger Property
  9. I think I understood your idea. I will try to do understand better I was imagining something more or less like below but need to know the right point to insert it ( In servermodule ??? ) procedure TForm1.FormCreate(Sender: TObject); begin Application.OnException := AppException; end; procedure TForm1.AppException(Sender: TObject; E: Exception); begin Application.ShowException(E); SendTheEnailToMe; /// <<<<<<< // Application.Terminate; end; // procedure TForm1.Button1Click(Sender: TObject); // begin // raise EPasswordInvalid.Create('Incorrect password entered'); // end;
  10. Thank you IRISOFT I will try to do something in this direction
  11. Thanks IRIGSOFT This will be useful but there is something that I can not understand and is ny main doubt Where is the "error detection" which would triger the text you wrote ?
  12. Hi. I am putting “in the air”, next few days – as free - a kind of calculation service prepared with Unigui. This forum helpd me alot to develop it. After registering, the user do the Login and may use the Service. I will post a link here next days to access it. The VCL version is working 10+ years and bugs are rare. For this Web version, certainly many bugs will come as the number of users increase. MY QUESTION IS: I would like to implement something, as simple as possible, to automatically return me, an e-mail message if (hen a user is using it) an error / bug occurs that does not allow to continue using it. Something like a token triggered by the error. Can anyone suggest me a small code that I can use as starting point ? I thank you in advance
  13. Thanks Sherzod . I have some difficulties with CSS. Idid a shoert movie showing exactly what I want to do Check here in this video http://www.cognitor.com.br/ClickingTwiceHeart.mp4
  14. Hello Sherzod If you wish I can do a short movie but I think will not be necessary. Go into any post of someone in Instagram and click twice over it togive a "LIKE". A heart will appear for 2 seconds.
  15. Please help me to understand the following. In certain apps, when there is a post in the screen of the cell phone, and we click twice in the post a figure appears (for example a heart) and few seconds after disappears. I imagine (please correct me if wrong) that when we click twice a cookie is created and send the order to show and hide the figure. Do you know any single Unigui code to do this? At least to let me understand the concept
  16. Just to record for future use Delphi Basics : IncMinute command
  17. Thank you very much Irigsoft . I was looking for something like this but simply did not find in many searches Regards
  18. How could I write the phrase marked below with ???? (date expire)to represente a Date time = now + 30 minutes. I am using MySql Server 8.0 procedure TuniMainModule.saveToken; var SaveTokenQuery: TMyQuery; begin SaveTokenQuery := TMyQuery.Create(nil); try SaveTokenQuery.Connection := ConnectionSFC; SaveTokenQuery.SQL.Clear; SaveTokenQuery.SQL.Add('INSERT INTO tokens(dateregister,dateexpire,token) VALUES (:dateregister, :dateexpire, :token);'); SaveTokenQuery.ParamByName('dateregister').AsDateTime := now; SaveTokenQuery.ParamByName('dateexpire').AsDateTime := now; /// Now + 30 minutes ??????????????????? SaveTokenQuery.ParamByName('token').AsString := token; SaveTokenQuery.Execute; finally SaveTokenQuery.Free; end; end;
  19. Thanks Ron I am doing some tests here and will comment at the end
  20. Hi Ron Thanks again. SQLs are terrible but I cpould find errors and could even make it to work in a "dirty" way. I used the code below. Now I am at the point of finding the rightplace tto put the lines in the end of this code (the part after the user click the link) procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean); var S1, S2, token : string; begin token:= UniSession.UniApplication.Parameters.Values['token']; if length(token)>0 then begin with getTokenQuery do begin SQL.Clear; SQL.text:= 'SELECT * from tokens WHERE `dateexpire` >now() and `token` = :token' ; if active then close; ParamByName('token').AsString:=token; open; if not (recordCount=0) then begin handled:=true; newAccount:=true; //delete token from db... end else begin handled:=false; verifyError:=true; //will send to login form, with error tab selected end; close; end; end; end; procedure TuniMainModule.saveToken; begin //insert into token values(0, now(), :token); with saveTokenQuery do begin SQL.Clear; SQL.text:= 'INSERT INTO tokens (dateregister,dateexpire,token) VALUES (now(), now() + interval 1 hour, :token) ' ; paramByName('token').AsString:=token; ExecSQL; end; end; { Check the place to put this cpRegistro.Visible := false; cpAutenticacao.Visible := true; lblregistered.Visible:= True; case uniMainModule.verifyError of true: begin // pcMain.ActivePage:=tsReceivedError; showMessage(' We are in the Experimental period and may be a bug in the Register . Please write yp sergiofeitozacosta@gmail'); end; false: begin // pcMain.ActivePage:=tsRegister; cpRegistro.Visible := false; cpAutenticacao.Visible := true; lblregistered.Visible:= True; end; end; }
  21. Thank you very much irigsoft Your text seems to be what I need . I will adaptate it to my use Thanks again
  22. I have a service with an Unigui code in which users pay a small amount to use a calculations code in the browser. I want to implement something to inform automatically 30 minutes before the end of the creditst that they will expire I want also to something that, if the credit went to zero (after those 30 minutes) , 5 minutes after the service is interrupted (Close with a message) Do you have any small code or sample to do this? Ideas are welcome
×
×
  • Create New...