Jump to content

Mehmet Emin

uniGUI Subscriber
  • Posts

    229
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Mehmet Emin

  1. Mehmet Emin

    webcam

    But dont forget that all communication must be over https/ssl otherwise it will not work. This is browser requirement
  2. Mehmet Emin

    webcam

    It is a working code (mobile form) in production. But it should work on desktop also.
  3. Mehmet Emin

    webcam

    1) to check if the user's computer has a webcam there is a code on stackoverflow.com you can use. 2) To snap an image and save to server I use these pieces of code: Have those index.html, adapter-latest.js and main.js available to browser (fix path references in index.html) On your TUnimForm put a TUnimHTMLFrame (hfrWebCam) and a TUnimBitBtn (btnTakePicture) for hfrWebCam HTML.Strings = ( '<iframe id="webcamframe"' ' src="/files/webrtc/index.html" ' ' style="width:[width]px; height:[height]px; border:none;"></if' + 'rame>') before activating hfrWebCam you replace [width] and [height] like below: hfrWebCam.HTML.Text := StringReplace(hfrWebCam.HTML.Text, '[height]', IntToStr(UniApplication.ScreenHeight - 20), []); hfrWebCam.HTML.Text := StringReplace(hfrWebCam.HTML.Text, '[width]', IntToStr(UniApplication.ScreenWidth - 20), []); then for btnTakePicture: function tap(sender, e, eOpts) { Ext.get(sender.id).setVisible(false); var win = document.getElementById("webcamframe").contentWindow; ajaxRequest(frmWebcamm.btnTakePicture, "saveimg", ["img="+win.getPicture()]); } To save the picture create an AjaxEvent: procedure TfrmWebcamm.btnTakePictureAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var SS: TStringStream; MS: TMemoryStream; FN: String; UploadDir: string; //frmCropImagem: TfrmCropImagem; LTextDetection: string; begin if SameText(EventName, 'saveimg') then begin SS := nil; MS := nil; FN := ''; try SS := TStringStream.Create(Params.Values['img']); MS := TMemoryStream.Create(); DecodeStream(SS, MS); UploadDir := TPath.Combine(UniServerModule.ServerRoot, 'protected\saveimg'); ForceDirectories(UploadDir); FN := TPath.Combine(UploadDir, LowerCase(TPath.GetGUIDFileName + '.jpg')); MS.SaveToFile(FN); LTextDetection := GoogleTextDetection(FN); if LTextDetection <> '' then TfrmChatm(frmChatm).edtChatMessage.Text := LTextDetection; Close; finally SS.Free; MS.Free; end; end; end; I hope it helps. index.html adapter-latest.js main.js
  4. Hello @picyka madExcept also works with uniGUI and will show you the exact location of your exception. Install madExcept eval and just add this few lines to your server module.
  5. I didnot check the demo but I remember reading in some threads of this forum that theme should be set when creating the MainModule.
  6. OK, browser will cache those static files after first fetch. But the first fetch speed is so important to user experience so please allow ExtRoot and other properties for setting static served files to be set like this. ExtRoot := 'http://cdn.aaaaaaaaa.com/' We need to have minimum impact on the web app server. It should serve the dynamic content. All static resources better served by a cdn. Thanks
  7. I tested this again and you should reproduce this error all the times if you have TUniGUIMainModule.TerminateOnBrowserClose set to TRUE
  8. Let's see if those inline variable declerations still mess up the IDE or not.
  9. If they are there to cache generated JS but uniGUI re-generates these when the same form created again in the same session. So what they are used for? Thanks,
  10. This may seem like a stupid question, but I'll ask anyway: Why the files under cache \ sessionid \ _SEQ ? What purpose do they serve?
  11. https://stackoverflow.com/questions/32638465/how-to-scroll-text-smoothly-using-html5 Burada css örneği var. Farklı tarayıcılar ile deneyin sorun yaşarsanız javascript ile denersiniz. Bu arada ServerModule üzerinde CustomCSS bölümüne ekleyebilirsiniz. Forumda uniGUI elementlerine nasıl CSS atayabileceğiniz konusunda arama yapın.
  12. @Hayri ASLAN Is it possible to add maxZoom parameter in next release to the current parameters of TUniMap.Locate https://leafletjs.com/reference-1.6.0.html#locate-options Thanks in advance
  13. Bunu CSS ile yapın. Timer uygun degil.
  14. My web app has only touch version/mobile forms so I don't need to switch to mobile platform with /m parameter added by uniGUI and redirection. I already tried setting autoplatformswitch to "off" on uniservermodule but does not help. How can I avoid this "/m" url path added? Thanks in advance
  15. Merhaba, uniGUI ile başlarken, eğer daha önce göz atmadıysanız geliştirici klavuzunu tümü ile incelemenizi öneririm. Database bağlantıları ve farklı thread lerin çakışmaması için MainForm, MainModule, ServerModule gibi nesnelere nasıl erişileceği ve diğer konular çok iyi açıklanmış durumda. Uygulamanızda birden çok form olacaksa veritabanı nesnesini MainModule üzerine yerleştirin. Query nesnesini form ya da MainModule üzerine yerleştirin. Bu arada ServerModule üzerinde rahatça thread başlatabilirsiniz sıkıntı olmaz ben sürekli kullanıyorum. procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject); içinden thread inizi başlatın FAPIRefreshThread := TAPIRefreshThread.Create(True); FAPIRefreshThread.FreeOnTerminate := True; FAPIRefreshThread.Start; Kapanırlen de öldürün gitsin. procedure TUniServerModule.UniGUIServerModuleBeforeShutdown(Sender: TObject); begin if Assigned(FAPIRefreshThread) then begin FAPIRefreshThread.Terminate; Log.Debug('APIRefreshThread thread terminated', LOG_MAIN); end; Kolay gelsin. ** Diğer sorunuza gelince 200 ekrana aynı data mı akacak yoksa hepsinin kendi sorgusu ayrı mı anlayamadığım için net bir cevap veremeyeceğim.
  16. Hi Abaksoft Before you get the authorised answer of Farshad I would like share my opinion. The method to place the database session component on ServerModule and the database connection component on the MainModule is the way to go because uniGUI handles user requests in a multi-threaded way and 99% of SQL components in the market requires their connection component to be used by one thread at a time. This architecture of uniGUI is fine as long as we get the resources when we need them and release them when the job done. For example FireDAC has connection pooling and offlining option. If you use FireDAC's offlining option you don't have to leave your connection open (you dont have to allocate it to one user during uniGUI session). As you finish getting your data to your datasets during handling client ajax calls just call the TFDCustomConnection.Offline method. This way you will close the connection resource and give it back to connection pool. Your datasets will be operational even after offlining. When you want to save changes etc. (when user saves) you can call Online method or there is implicit automatic activation. So this offlining option is critically important to share connections between uniGUI sessions.
  17. Most of the development with uniGUI is many many times faster compared to other tools but sometimes I stuck with this type of basic issues. For the past hours I have been searching the forum just to resize a column of TUnimDBListGrid as client side resize events. I have 2 columns and I want to flex first one so that it is maximized and second column to have minWidth. Thanks in advance
  18. Can I safely use uniGUI frame a mobile form? Is seems to have properties that mobile forms has not (like layout options form desktop components.) Thanks
  19. I guess I know the reason for the first one only. May be it has to do with uniGUI back button warning (just a guess)
  20. Why I am getting these console error messages? I just realized and it is a very simple mobile form with 3 buttons. Thanks
  21. Gerhard I am using your themes. And would like to purchase mobile themes. Are they available?
  22. Here is my unigui qr code generator You will need DelphiZXingQRCode though procedure TUniMainModule.CreateTicketQRCode(const ATicketId, ATicketUrl: string); procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, NewHeight: integer); var buffer: TBitmap; begin buffer := TBitmap.Create; try buffer.SetSize(NewWidth, NewHeight); buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap); Bitmap.SetSize(NewWidth, NewHeight); Bitmap.Canvas.Draw(0, 0, buffer); finally buffer.Free; end; end; var QRCodeBitmap: TBitmap; QRCode: TDelphiZXingQRCode; Row, Column: Integer; PNG: TPNGImage; begin if UniServerModule.ConfigINI.QRCodeSaveDir = '' then Exit; QRCodeBitmap := nil; QRCode := nil; PNG := nil; try QRCodeBitmap := TBitmap.Create; QRCode := TDelphiZXingQRCode.Create; QRCode.Data := ATicketUrl; QRCodeBitmap.SetSize(QRCode.Rows, QRCode.Columns); for Row := 0 to QRCode.Rows - 1 do begin for Column := 0 to QRCode.Columns - 1 do begin if (QRCode.IsBlack[Row, Column]) then begin QRCodeBitmap.Canvas.Pixels[Column, Row] := clBlack; end else begin QRCodeBitmap.Canvas.Pixels[Column, Row] := clWhite; end; end; end; ResizeBitmap(QRCodeBitmap, QRCode.Rows*5, QRCode.Columns*5); PNG := TPNGImage.Create; PNG.Assign(QRCodeBitmap); PNG.SaveToFile(TPath.Combine(UniServerModule.ConfigINI.QRCodeSaveDir, LowerCase(ATicketId)+'.png')); finally QRCodeBitmap.Free; QRCode.Free; PNG.Free; end; end;
  23. Since there is no source code available for TUniGUISession and no documentation of this property except a usage in a demo for UniGUIAuxExceptionHandler with Eureka I looked at that code and thougth that if Farshad Mohajeri put this line here there should be a reason. I could not see a difference in my case but I keep it there anyway. I think it is there to disable web user feed with dumps etc. in case something goes wrong (I dont see any different).
×
×
  • Create New...