Jump to content

andyhill

uniGUI Subscriber
  • Posts

    1268
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by andyhill

  1. I have a procedure that within the code while loop (while not Query.Eof do begin etc.) I want to Execute 2 Ajax Events (repeated over and over on each record):- ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// WaitLoopFlag:= True; UniSession.AddJS('ajaxRequest(fMain.HtmlMemo, ''_sample_'', []);'); // On Completion WaitLoopFlag Is Set To False while WaitLoopFlag = True do begin Sleep(5000); end; ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// WaitLoopFlag:= True; UniSession.AddJS('ajaxRequest(fMain.HtmlMemo, ''_process_'', []);'); // On Completion WaitLoopFlag Is Set To False while WaitLoopFlag = True do begin Sleep(5000); end; My problem is the Ajax Events are never fired when called within a loop, can anyone please advise how to resolve - thanks in advance
  2. Thank you again Sherzod. Moving forward, is there a way to execute that function elsewhere in my form other than the input onclick event buried in the html code. For example I could place a button on the ToolBar, then on that button's click event execute that javascript function ?
  3. Sorry, I over looked that extra piece of info "top." can you please explain why I need that - thanks
  4. No, not here, modified project attached - plus EXE Project1-Modified.zip
  5. ' printPage = function(id) '+ ' { '+ ' alert(''Here''); '+ ' var html = "<html>"; '+ Alert Never Fires ?
  6. 7-0-0 1531 Does not work ? procedure TMainForm.UniFormCreate(Sender: TObject); var s: String; begin ////////////////////////////////////////////////////////////////////////////// HtmlMemo.ClientEvents.ExtEvents.Clear; s:= 'afterrender=function afterrender(sender, eOpts) '+ '{ '+ ' printPage = function(id) '+ ' { '+ ' var html = "<html>"; '+ ' html += sender.getDoc().getElementById(id).innerHTML; '+ ' html += "</html>"; '+ ' var printWin = window.open('''', '''', ''left=0, top=0, width=1, height=1, toolbar=0, scrollbars=0, status=0''); '+ ' printWin.document.write(html); '+ ' printWin.document.close(); '+ ' printWin.focus(); '+ ' printWin.print(); '+ ' printWin.close(); '+ ' } '+ '} '; HtmlMemo.ClientEvents.ExtEvents.Add(s); ////////////////////////////////////////////////////////////////////////////// HtmlMemo.Lines.Clear; s:= '<div id="block"> '+ ' What is Lorem Ipsum?<br><br>'+ ' Lorem Ipsum is simply dummy text of the printing and typesetting industry. '+ ' Lorem Ipsum has been the industry''s standard dummy text ever since the 1500s, '+ ' when an unknown printer took a galley of type and scrambled it to make a type specimen book. '+ ' It has survived not only five centuries, but also the leap into electronic typesetting, '+ ' remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset '+ ' sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like '+ ' Aldus PageMaker including versions of Lorem Ipsum.'; HtmlMemo.Lines.Add(s); ////////////////////////////////////////////////////////////////////////////// s:= '</div> '+ '<br> '+ '<input type="button" value="Print" onclick="printPage(''block'');"></input> '; HtmlMemo.Lines.Add(s); end;
  7. Whats happening Sherzod, I gave you the test project ?
  8. I am trying to get this Print Code to work inside a UniGui HtmlMemo - can anyone please advise why this basic code does not work with UniGui ? HtmlMemo.Lines.Clear; ///////////////////////////////////////////////////////////////////////////////// s:= ' <script> '+ ' function printPage(id) '+ ' { '+ ' var html="<html>"; '+ ' html+= document.getElementById(id).innerHTML; '+ ' html+="</html>"; '+ ' var printWin = window.open('', '', ''left=0, top=0, width=1, height=1, toolbar=0, scrollbars=0, status=0''); '+ ' printWin.document.write(html); '+ ' printWin.document.close(); '+ ' printWin.focus(); '+ ' printWin.print(); '+ ' printWin.close(); '+ ' } '+ ' </script> '+ ' <div id="block"> '; HtmlMemo.Lines.Add(s); ///////////////////////////////////////////////////////////////////////////////// add additional html code here ///////////////////////////////////////////////////////////////////////////////// s:= ' </div> '+ ' <br> '+ ' <input type="button" value="Print" onclick="printPage(''block'');"></input> '; HtmlMemo.Lines.Add(s);
  9. When one assigns the Port to the Server (UniServerModule.Port:= HttpPort and UniServerModule.SSL.SSLPort:= SslPort) UniGUI binds those ports to all NIC assigned IP's - this is not good. According to the Indy People we need 2 Bindings, one for port 80 and one for port 443. The workaround was to set UniServerModule.Port:= 0 (kill global binding), UniServerModule.SSL.SSLPort:=0 (kill global binding) and add Binding Records, then from here assign the desired IP's and Port's. UniServerModule.Bindings.Items[0].IP:= BindToIpStr; UniServerModule.Bindings.Items[0].Port:= HttpPort; UniServerModule.Bindings.Items[1].IP:= BindToIpStr; UniServerModule.Bindings.Items[1].Port:= SslPort; Now the downfall of having UniServerModule.Port:= 0 (kill global binding) is that the only way to access the site now is via https which Indy navigates automatically, in principle this is not an issue if the user knows he must use https, if he dose not know then the http protocol will fail and he will not arrive at your site. I have begged Farshad many many times to NOT GLOBALLY BIND ALL IP's. Farshad, please address this problem -or- provide a work around where one can run multiple StandAlone WebServers on the same PC bound across different IP's.
  10. Do you have an English narrative ?
  11. Thank You Sherzod. Feed back:- First Option (StrToJS) only works in an empty paragraph Second Option ([]) inserts between characters and empty paragraphs Would you please explain why we have to deal with inline differently ?
  12. How many times must I ask, if it is a bug then acknowledge it please along with fix ETA, if it is my code then please explain why it works in browsers but not in your HtmlMemo ?
  13. Please advise, script code in file attached - please run in browser. Why does the same script not run in HtmlMemo ? InlineData.html
  14. The actual data is wrapped by double quotes, if you take the complete tag string, turn it into a html file and execute it by the browser it all works.
  15. Sherzod, Have you run this code and got errors like me, if so how do we fix ?
  16. Run this code:- InlineData:= '<img id="img1" src="data:image/jpeg; charset=utf-8; base64, /9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcU FhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgo KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAAyAGQDASIA AhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAQFAQIDBgf/xAAZAQEBAQEBAQAAAAAAAAAAAAAA AQMCBAX/2gAMAwEAAhADEAAAAfqgGu1dE3aHXpeZqZNStau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vCyaI4a7wwIEODjzm+sgWjUDoKx1t+2K8DmUo7QeNX2aXC1FzQB8eSzwzS5bgKmCn6 r8x75bXobICThJpeCnsywYOkWeQvTneIc5iJ8x9He9ApiwAyd6GQSo4bpsGmSBqt/AwIM211dgEF +M0sgtgeTtHvjlkwVFw9roHA4EPUcDsyAYhvgp9hB2XIj8juNwdpRLBuzKUFEdtOhS9tnjAY25EF AyCtvBMpa2piSeSTnWOAh2Gryq7X0ahGJAxdcYagfZdbbuOI+6lCCwr+ncwwyAtbXT0PLr94gpTQ VcRxLo5LDw2TBtcKqIEl68YdUAYTFdggEPJlnwqIAqPGNx/3hEhGu3ejzMCW6xJ6FuHh7xOkoxNR QnZH8eq1YMe3L+jKDjVBWyzLL8qxCDe8rBt4gUw8wIDEQvgyARNJPOEE+ATEv3/b3womdphk7oJ/ yYFoQ00VUngTXzkkNZ0LNNnw0ZUfYATp0ECnzhwA9cS05ff1dCKIjlJApFoXR8YumkUIPawyTBoB TvgQdcvWMDDn2ahoOb/jAkFWsUSAD22vRk5GSQewAF9rxgjz1z3A3ODVw5g6cXh0q8mz750zU04v f1n8P//Z" alt="" width="100" height="50" style="display: block; margin-left: 4px; margin-top: 2px;">'; UniSession.AddJS(HtmlMemo.JSName + '.insertAtCursor('+ Chr(39)+InlineData+Chr(39) +')');
  17. Yes, works in _img_ event but not in dblclick event but I now understand why - thank you. Also can you resolve inline issue mentioned earlier. In addition if you drag an image inside HtmlMemo it disappears ???
  18. HtmlMemo.ClientEvents.ExtEvents.Clear; s:= 'initialize=function initialize(sender, eOpts) '+ '{ '+ ' sender.getDoc().addEventListener(''dblclick'', function() '+ ' { '+ ' if (arguments[0].target && arguments[0].target.tagName.toLowerCase()==''img'') '+ ' { '+ ' alert(arguments[0].target.getAttribute(''id'')); '+ ' } '+ ' }); '+ '} '; HtmlMemo.ClientEvents.ExtEvents.Add(s); // Alert event fires: 'id' Always shows null 'dblclick' event fires: 'id' Always shows '' //////////////////////////////////////////////////////////////////////////////////////////////////// HtmlMemo.ClientEvents.ExtEvents.Clear; s:= 'initialize=function initialize(sender, eOpts) '+ '{ '+ ' sender.getDoc().addEventListener(''dblclick'', function() '+ ' { '+ ' if (arguments[0].target && arguments[0].target.tagName.toLowerCase()==''img'') '+ ' { '+ ' ajaxRequest(sender, ''_img_'', ["id="+arguments[0].target.getAttribute(''id'')]); '+ ' } '+ ' }); '+ '} '; HtmlMemo.ClientEvents.ExtEvents.Add(s); // 'dblclick' event fires: 'id' Always shows '' '_img_' event fires, 'id' Always shows '' Please advise ?
×
×
  • Create New...