Jump to content

Oliver Morsch

uniGUI Subscriber
  • Posts

    356
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Oliver Morsch

  1. This works for me (you must give the component a unique name): procedure TMainForm.UniButton4Click(Sender: TObject); var aPnl: TUniPanel; begin aPnl := TUniPanel.Create(self); aPnl.Left:= 30; aPnl.Top := 400; aPnl.Caption := 'Test'; aPnl.Name := 'MyTestPanel'; aPnl.ClientEvents.ExtEvents.Add('OnAfterrender=function OnAfterrender(sender){document.getElementById(sender.body.id).className += " hoverpanel";}'); aPnl.Parent := self; end;
  2. Try this: Apanel.ClientEvents.ExtEvents.Add('onAfterrender=function onAfterrender(sender) { ...
  3. Then I would use long polling to refresh "the monitor".
  4. Do I understand right: You want to "push" changes from the server to the client (without that the client has sent a request to get this)? In UniGui/Web you can only answer to a request from the client! You can use an UniTimer, use websockets (HTML5) or use "Long Polling" (see here)
  5. // UniForm1.script: function setMaskeventClosewindow(target) { var elements = document.body.getElementsByTagName('div'); for (var i = 0; i < elements.length; i++) { if (elements[i].className.indexOf('mask') != -1) { elements[i].onclick = function() {target.close();}; } } } // UniForm1.onShow: procedure TuniForm1.UniFormShow(Sender: TObject); begin UniSession.AddJS('setMaskeventClosewindow(' + self.WebForm.ExtWindow.JSName + ');'); end; // call in MainForm: UniForm1.ShowModal;
  6. MessageDlg, ShowModal, ShowMessage don't "stop" the code execution in UniGui/WebMode, so you do: (1) You start a Modal Dialog and (2) give a (the initial !) result back. (3) After you click on OK/Cancel/Yes/No/... (4) the anonymous procedure (callback procedure) is called => (2) is before (3) and (4) so it can't contain the future result !!!
  7. Do you use (1) a database component such as TTable and use Table.append/insert OR (2) send SQL statements to the database server (insert into table ....) 2nd should be better for your purpose. And how is the RAM usage on the server: How much it increases by a new user session and over time?
  8. (1) Use show instead of showmodal OR (2) After showmodal you must use javascript and search a div element with class "x-mask" and add an onclick event there which closes the form.
  9. Instead of using a (global) function "choose_city(): integer" which returns an integer, I would use a (global) procedure "choose_city(DoAfterChooseCity: TDoAfterChooseCityProc)" which gets an anonymous procedure that contains the code to do after the city was choosen. And then call: choose_city(procedure(CityCode: Integer) begin //do this after the user has choosen a city... end);
  10. And I tried to use "sender.body.className" without success, so that I had to do this: "document.getElementById(sender.body.id).className"... thx
  11. Simple version: -> in "TUniPanel / ClientEvents / ExtEvents -> OnAfterrender": function OnAfterrender(sender) { document.getElementById(sender.body.id).className += " hoverpanel"; } -> in "UniServerModule / CustomCSS": .hoverpanel:hover { background-color: #0077FF; }
  12. I think you are looking for this: http://mobile.stimulsoft.com/Designer.aspx?reportname=SimpleList In reportmanager there is also an exe for creating reports standalone. But I think it is not usable by end users.
  13. I use reportmanger (open source, http://reportman.sourceforge.net/ ). This comes with an additional console app to create PDF's. This I start using createProcess() in UniGui-App and give it the needed parameters. It's very very fast.
  14. Hi! I have developped a message server, so you can send "push" messages at any time from the server to the web client (using long polling). You can also send messages from a client to another client (with message server in the middle). The message server is a standalone app. You must run MsgSrv.exe and MsgCli.Exe (second is a uniGui project). I was using Delphi XE3 (with generics, class vars, ...), so i have included the .exe, because the message server does not compile in old delphi versions. For details see the commented screenshot. Regards Oliver MsgSrv.zip
  15. I have to do and test a view things. After that I will share it.
  16. Solved! I had not to change the UniGui response header. I had to change the XMLHttpRequest header (no custom headers) and the message server response header (add " Access-Control-Allow-Origin: * " there). Now I have "long polling" and so I can send "push messages" from UniGui server to all UniGui clients (browsers) and more.
  17. Hi! Is it possibble to add something to the http header (response)? I have an own standalone "message server" on another port and use XMLHttpRequest (in clientside javascript) to get/post messages. In IE10 it works properly. But in Chrome it returns with status 0 and I think this is because XSS security. So I want to try the "Content-Security-Policy" header. Regards Oliver
  18. Send the value of the javascript variable to the server using ajaxRequest(...)
  19. Use either TField.OnGetText() or a calculated field to change the text before displaying.
  20. see here: http://stackoverflow.com/questions/9904100/how-to-get-client-machines-mac-address-in-a-web-application
  21. Use "self.Components..." or just "Components..." instead of "UniFrame3.Components...". And never use a global var, because each user/session would use the same var. If needed use fields / properties.
  22. You can buy a file manager (file browser and uploader) on http://www.tinymce.com/index.php (but i think it needs PHP on server) or you can make your custom file browser (with UniGui): http://www.tinymce.com/wiki.php/Configuration3x:file_browser_callback http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_a_custom_file_browser There you can upload (TUniFileUpload) and/or browse your files to/on the server. I have added this to my script/init for including TinyMCE (adds a button to file/image dialog for calling my file browser): <script type="text/javascript"> function myCustomFileBrowser(field_name, url, type, win) { //z-Order of tinyMCE popup dialog must be less than uniGui modal dialog: document.getElementById('mceModalBlocker').style.zIndex = 7001; document.getElementById('mceModalBlocker').previousSibling.style.zIndex = 7002; //"save" fieldname for later update: TinyMceFileSrcFld = win.document.forms[0].elements[field_name]; //Start my UniGui FileBrowser: ajaxRequest(MainForm.form, 'FileBrowser', [ 'URL=' + url, 'Typ=' + type ]); } ... tinyMCE.init({ ... file_browser_callback : "myCustomFileBrowser", ... }); </script> on MainForm i have this (on AjaxRequest start file browser form): procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName = 'FileBrowser' then begin frmFileBrowser.URL := Params.Values['URL']; frmFileBrowser.Typ := Params.Values['Typ']; frmFileBrowser.ShowModal; end; end; on closing the file browser form i do this: procedure TfrmFileBrowser.UniFormClose(Sender: TObject; var Action: TCloseAction); begin if ModalResult = mrOK then begin UniSession.AddJS('TinyMceFileSrcFld.value = ' + QuotedStr(FileURL) + ';'); end; end; In the future i plan to use Data URI scheme to include the image in the HTML itself.
  23. You can use "ajaxRequest(...)" in the javascript function "function Onmousemove(sender, x, y){...}" to send the values as parameter to the server and handle it there in delphi (see forum). But: The event Onmousemove you should handle in javascript, because there would be very much messages send to the server.
×
×
  • Create New...