Jump to content

lynkfs

Moderators
  • Content Count

    743
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by lynkfs

  1. Something like this var Script : variant := browserapi.document.createElement('script'); Script.src := '<your script statements>'; browserapi.document.head.appendChild(Script); Script.onload := procedure begin writeln('script loaded'); end; you can put <the script statements> as javascript in an asm block or alternatively pascalify them : var atOptions : variant := new JObject; atOptions.key := '000000'; etc
  2. probably this link :
  3. The listbox items map to the <input type=text> html element, which are single line items (EditBox) A multi line item would have to map to say a <textarea> element (Memo) In this case you would have to roll your own listbox component, which generates html like below You can delve a bit in the SmartCl.Controls.ListBox unit to see how this component has been put together. For instance Height can be set by coding W3ListBox.ItemHeight := 60;
  4. There is no expiration date on local storage However, users can manipulate local storage themselves, or the browser can decide to purge when it needs memory, so there is no guarantee it will always exist. Local storage is also specific per protocol, so http:// and https:// point to different storage objects. Also storage in private browsing mode gets handled with specific rules. You can set an expiration yourself if necessary though
  5. I've always loved the basic data-structures as described in this link. Since I needed a double linked list the other day, I transcribed all of the major basic structures from js into object pascal : Array Hash Table Set Singly Linked List Doubly Linked List Stack Queue Tree Graph Source and test-files here
  6. https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity is probably a good starting point
  7. This looks like a non-solvable problem. Apparently Apple changes his/her mind often how to implement this in the various mobile iOS Safari versions and the OS hardware event checking seems to take precedence over html processing. If you change the <body> part of the index.html file to this <body> <script type="text/javascript"> /* This prevents the window being moved by touches, to give the impression of a native app */ document.ontouchmove = function(e) { e.preventDefault(); } document.addEventListener("touchstart", event => {window.alert("tou
  8. Got hold of an iPhone, and yes, I see the problem. Testing some possible solutions, probably tomorrow though
  9. The standard generated index.html should prevent what you're experiencing : <meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0, user-scalable=no"/> At least on Android and iPad it does. However there have been problems reported in mobile Safari ( https://stackoverflow.com/questions/37808180/disable-viewport-zooming-ios-10-safari https://stackoverflow.com/questions/10614481/disable-double-tap-zoom-option-in-browser-on-touch-devices If your problem is indeed linked to mobile/Safari on iPhones, then you can also disable z
  10. lynkfs

    routing

    Routing is the link between specific url's and specific functionality in an app, so f.i. https://<server>/index.html starts up your app in the browser as per normal https://<server>/login executes a specific view (f.i a login form) Smart per default produces single page app's, without routing functionality There are a couple of strategies which can be followed to implement routing (and which will work to some extent) : use # formatted urls. Browsers have a 'hashchange' event built in, which fires every time a url changes,
  11. lynkfs

    SEO

    Search Engine Optimisation - SEO Over the years I have made quite a few websites with Smart, but eventually stopped doing that. Reason is that Smart produces single page applications (or multiple if you like) and SEO for these type of apps is essentially impossible. Search engine crawlers look for html, which is what feeds their indexing effort. This is completely absent in the standard index.html file, so essentially they see an empty page. Google's googlebot is supposed to be able to execute the js bit during its crawling, but I find the indexing results below par. The
  12. Apparently the signature of the promise.then function (executor function) in the compiled js file needs to be exactly like this : promise.then(function () { //console.log('success'); }, function () { //console.log('error'); }) As long as the compiler ejects this structure, it works fine Probably other team members could shed some more light on this ?
  13. lynkfs

    font choice

    Styling on the web is really messy, and takes a lot of effort to get it right. As a matter of personal interest, I'm collecting as many 'design rules' underpinning good styling as I can. Like : In the typography area, I came across this site. It uses machine learning to identify font-families which work well together. It uses Google fonts as its domain, and outputs a header, sub-header and text font (similar to h1, h2 and p) I really like its recommendations (usually using the 'similar' setting)
  14. @jarto unearthed an interesting problem to do with promises Basically the <promise>.then function has as parameters 2 call back functions. The first one will be executed on success, the second if there is an error. mypromise.then(procedure begin ...success... end, procedure begin ...error... end) This works fine. However defining these callbacks as regular external procedures and substituting these in the promise function call goes awfully wrong : procedure SuccessProc; begin writeln('success'); end; mypromise.then(SuccessProc, ErrorProc); This co
  15. Works from server only, the one specified in the credentials page var document external 'document': variant; var console external 'console': variant; var gapi external 'gapi': variant; implementation { TForm1 } procedure TForm1.InitializeForm; begin inherited; // this is a good place to initialize components var Script := document.createElement('script'); Script.src := 'https://apis.google.com/js/api.js'; Script.setAttribute('async',''); Script.setAttribute('defer',''); document.head.appendChild(Script); Script.onload := procedure begin writeln('loaded'
  16. Glad you're back Could you elaborate on the upcoming 4.0 ?
  17. zoom is not supported in firefox (https://caniuse.com/#search=zoom) and opera The workaround is to use the "transform" css function W3Panel1.handle.style.transform := "scale(1.5)"; You can scale to different values for x and y as in "scale(2, 3)"
  18. Read this article , at least till the paragraph "and now for the fun part". Mindblowing. Then, after that, have a look at this
  19. I've just compiled some large regular projects and some based on my own rtl : no problems so maybe your projects have some special dependencies, or ... just to be sure, how I tested this : - navigated to the smsc directory - opened cmd window - smsc "G:\SMS3.9.1\Projects\animate5\animate5.sproj" tested with fully developed projects (Not sure, but don't think the ide itself uses smsc)
  20. The syntax is Usage: smsc [@optionFile] [options] project_name[.sproj|.pas] [options] -output-name=<fileName> Output file name -resource-path=<paths> Resource directories -unit-path=<paths> Unit directories -verbosity=none|normal|verbose Verbosity level -hints=disabled|normal|strict|pedantic Hints level -stage=compile|codegen|output Last compile stage -defines=<defines> Custom conditional defines -search-path=<paths> Search path
  21. do something like this (max control) var Script := browserapi.document.createElement('script'); Script.src := 'https://.......your script url ........'; browserapi.document.head.appendChild(Script); Script.onload := procedure begin showmessage('loaded'); ... do your thing ... end; this can be part of a button click handler
  22. Your code should work, except for the script placement. The below code is pretty much the same as yours, just embedded in a button click handler (which you might have done too) var W3Button : TW3Button := TW3Button.Create(W3Panel); W3Button.SetBounds(580,-10+160*(cartitems.length+1),200,40); W3Button.Caption := 'Make Payment'; W3Button.OnClick := procedure(sender:TObject) begin var PayPal : TW3Panel := TW3Panel.Create(W3Panel); Paypal.SetBounds(140,100 + 160*(cartitems.length+1),400,800); //position below cart Paypal.StyleClass := 'DIV';
×
×
  • Create New...