Jump to content

Tokay

uniGUI Subscriber
  • Posts

    839
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by Tokay

  1. Is it possible to disable or hide refresh button under UniDbGrid? Other controls should stay in normal state. Because it doesn't reopen dataset it's unusable. I've added external refresh buttons on the correspond forms.
  2. Tokay

    Need advise in UI

    Login form could be absolutely borderless. But regular forms couldn't, or I could not found how to do it.
  3. Tokay

    Need advise in UI

    Common question: is it possible to show a window, not main, without border (like a login form)? I set BorderStyle = bsNone, WindowState = wsMaximized, but there is still a small border.
  4. In any place where you have UniSession you can write: UniSession.ARequest.Cookies.Cookie['UNI_GUI_SESSION_ID', '].Value;
  5. I'm try in the current version (1.50): UniCanvas1.Picture.Bitmap.Canvas.Brush.Color := clBtnFace; UniCanvas1.Picture.Bitmap.Canvas.FillRect(UniCanvas1.Picture.Bitmap.Canvas.ClipRect); Works fine here.
  6. The hfrDropbox is TUniHTMLFrame component. Original theme you can see here: http://forums.unigui.com/index.php?/topic/2490-multiple-file-upload/ We catch files here: UniServerModule.OnHTTPCommand > if Assigned(ARequestInfo.PostStream) then and do parsing of mime format with help of TIdMessageDecoderMIME. Distributing files by users is doing with help of sessions IDs that coming into OnHTTPCommand in cookies: Cookie := ARequestInfo.Cookies.Cookie['UNI_GUI_SESSION_ID', ''];
  7. we've made script for upload with help of drag-drop from sample from forum with progress: <script type="text/javascript"> // set vars (RUN = DoInit, ajaxtarget = Target for ajaxRequests, dropbox = dropbox Element for events): var RUN = false; //!!! var ajaxtarget = fraMultiUpload.hfrDropbox; //!!! var dropbox = document.getElementById( fraMultiUpload.pnlDropbox.id ); function dragEnter( evt ) { evt.stopPropagation(); evt.preventDefault(); } function dragExit( evt ) { evt.stopPropagation(); evt.preventDefault(); } function dragOver( evt ) { evt.stopPropagation(); evt.preventDefault(); } function drop( evt ) { evt.stopPropagation(); evt.preventDefault(); // get Files and Count: var files = evt.dataTransfer.files; var count = files.length; // Only call the handler if 1 or more files was dropped: if (count > 0) { handleFiles( files ); } } function initEventHandlers() { // set EventHandlers for dropbox for drag and drop: dropbox.addEventListener( "dragenter", dragEnter, false ); dropbox.addEventListener( "dragexit", dragExit, false ); dropbox.addEventListener( "dragover", dragOver, false ); dropbox.addEventListener( "drop", drop, false ); } function removeEventHandlers() { dropbox.removeEventListener( "dragenter", dragEnter, false ); dropbox.addEventListener( "dragexit", dragExit, false ); dropbox.addEventListener( "dragover", dragOver, false ); dropbox.addEventListener( "drop", drop, false ); } function handleFiles( droppedFiles ) { var isAdvancedUpload = function () { var div = document.createElement( 'div' ); return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && 'FormData' in window && 'FileReader' in window; }(); if (isAdvancedUpload) { var fd = new FormData(); for (var a = 0; a < droppedFiles.length; a++) { var file = droppedFiles[a]; fd.append( "files[]", file, file.name ); } //check total files size for (var i = 0, size = 0; i < droppedFiles.length; i++) size += droppedFiles[i].size; if (size > 1024 * 1024 * 1024) { ajaxRequest( ajaxtarget, "upload_warn_max_file_size" ); return false; } else { ajaxRequest( ajaxtarget, "upload_start" ); } var $progress = $( '<progress id="uni-upload-progress" max="100" value="0">0%</progress>' ); $progress.css( { display: "block", margin: "auto", position: "relative", top: "94px", width: "300px", height: "20px" } ); $( dropbox ).find( "[data-ref=innerCt]" ).append( $progress ); $.ajax( { xhr: function () { var xhr = new window.XMLHttpRequest(); function progress( evt ) { if (evt.lengthComputable) { var percentComplete = evt.loaded / evt.total; //Do something with download progress $progress.text( (percentComplete * 100).toFixed( 2 ) + "%" ).val( percentComplete * 100 ); // ajaxRequest( ajaxtarget, "upload_progress", ['percentComplete='+percentComplete] ); } } xhr.upload.addEventListener( "progress", progress, false ); xhr.addEventListener( "progress", progress, false ); return xhr; }, url: "/HandleEvent?action=uni-multiupload", type: "POST", data: fd, cache: false, timeout: 0, processData: false, // tell jQuery not to process the data contentType: false, // tell jQuery not to set contentType //data - data returned from server success: function ( data, textStatus, jqXHR ) { if (typeof data.error === "undefined") { // Success so call function to process the form ajaxRequest( ajaxtarget, "upload_complite_success" ); } else { //we can handle errors on server side or send to client JSON {"error":"some error text"} // received data from server in ajaxRequest( ajaxtarget, "upload_complite_error_server" ); } }, error: function ( jqXHR, textStatus, errorThrown ) { // files dont sended ajaxRequest( ajaxtarget, "upload_error_transport", ["message=" + textStatus] ); }, complete: function () { // last trigger after success and errors // hide progressbars or everything else ajaxRequest( ajaxtarget, "upload_complite_finaly" ); setTimeout( function () { $progress.remove(); }, 5000 ); } } ); } else { console.log( 'Browser dont support FormData object or drop event' ); } } if (RUN == true) { initEventHandlers(); } </script> procedure TUniForm1.hfrDropboxAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'upload_start' then Inc(FCounter); if EventName = 'upload_complite_success' then Dec(FCounter); if EventName = 'upload_complite_error_server' then begin ShowMakhDlg('Error occured while uploading process'); Dec(FCounter); end; if EventName = 'upload_complite_finaly' then ShowMakhDlg('Upload compilted'); if EventName = 'upload_warn_max_file_size' then begin ShowMakhDlg('You can upload a file with size more than 1 GB'); Dec(FCounter); end; end;
  8. It works almost as well as it should. Only the arrow on the right is missing. We need sorting and column moving. Please look is it possible to do?
  9. Ok, I'll try. Thank you very much!
  10. If you generate less then $5000 a year you can use Delphi CE absolutely for free, BTW. I converted three apps to the UniGui from WinGui. About 100 forms for a momenet. Forms are looks even better then in the old gui. UniGui is really great. We are going to renew subscription.
  11. I currently have a grid with headers that you can see on the left image. It's the real screenshot. But I need that the header of grid will look like on the right image, it's fixed with paint version.
  12. Is it possible to change TUniDBGrid from the current view to a new? I've attached two files. We don't need the caption, only the filter.
  13. If you have the sources, you can try to change StrToFloat to StrToFloatDef. Generally, the best practice is not to use StrToFloat anywhere.
  14. Also we've found a better solution for event. Selected text is nedded in the event handler of a button, therefor issue can be solved in this way (sample for two memos): function click(sender, e, eOpts) { var selText1 = Form1.UniHTMLMemo1.selectedText, selText2 = Form1.UniHTMLMemo2.selectedText; if (selText1 || selText2) ajaxRequest(sender, 'selectedTexts', [ "UniHTMLMemo1="+selText1, "UniHTMLMemo2="+selText2 ]); } Server side: procedure TForm1.UniToolButton1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var s: string; begin if EventName = 'selectedTexts' then begin s := Params.Values['UniHTMLMemo1'].Trim; s := Params.Values['UniHTMLMemo2'].Trim; end; end;
  15. We've made a fix on the new UniGUI version (function sync removed): function afterrender(sender, eOpts) { sender.activated = true; var me = sender; me.selectedText = ""; setTimeout( function(){ me.getDoc().onselectionchange = function(e) { var doc = me.getDoc(), clip = "", selDocFrag; var txt = '', hasHTML = false, selNodes = [], ret, html = '', textParse = ''; //if (me.win.getSelection || doc.getSelection) { if (doc.getSelection || me.win.getSelection) { // FF, Chrome, Safari var sel = doc.getSelection(); if (!sel) { sel = me.win.getSelection(); } if (!sel.isCollapsed){ if (clip) { selDocFrag = sel.getRangeAt(0).extractContents(); } else { selDocFrag = sel.getRangeAt(0).cloneContents(); } Ext.each(selDocFrag.childNodes, function(n) { if (n.nodeType !== 3) { hasHTML = true; } }); if (hasHTML) { var div = document.createElement('div'); div.appendChild(selDocFrag); html = div.innerHTML; txt = sel + ''; var children = sel.getRangeAt(0).cloneContents().childNodes; for (var i = 0; i < children.length; i++) { var child = children[i]; textParse += child.textContent; if (child.nodeName === 'DIV'){ textParse += '\r\n'; } } } else { html = txt = selDocFrag.textContent; } } ret = { textContent: txt, hasHTML: hasHTML, html: html }; } else if (doc.selection) { // IE me.win.focus(); txt = doc.selection.createRange(); if (txt.text !== txt.htmlText) { hasHTML = true; } ret = { textContent: txt.text, hasHTML: hasHTML, html: txt.htmlText }; } else { ret = { textContent: '' }; } me.selectedText = textParse || ret.textContent; return ret; }; },1000); }
  16. I've found this solution (client side): function keydown(sender, e, eOpts) { if (e.getKey() == 13) { document.getElementById(UniLoginForm5.UniButton1.id).click(); }; }
  17. I probably found place of this bug It could be fixed in source. I reported it to the support portal.
  18. We used UniSession.SendFile about ten times in different places, and need to delete temporary created files after send files to users. Is it a way to do it? Perfectly if it'll be uniformly in all places, not with many-many timers.
  19. Ok, it simply. It looks as in shot here. test_prj.7z
  20. I try to change Colors, but nothing was changed. Default settings: #0000FF #00FF00 #FF0000 #00FFFF #FFFF00 #FF00FF I changed to: #1000FF #10FF00 #1F0000 #10FFFF #1FFF00 #1F00FF but the gauge looks same (DefaultColors = False everyehere)
  21. Is it possible to change color of TUniGaugeSeries? I try to do it, but wothout seccess.
  22. I used Lazarus to porting million+ source code project to Linux from Delphi/Win. All done successfully. Lazarus is good project as for free.
×
×
  • Create New...