Jump to content

lynkfs

Moderators
  • Content Count

    743
  • Joined

  • Last visited

  • Days Won

    146

Reputation Activity

  1. Like
    lynkfs reacted to jarto in Development updates   
    New update available:
    RTL:
    TW3ListMenu: Add Items-property, so items can created in Object Inspector. Add OnSelected-event. IDE:
    Bug fix to renaming of units Show form source instead of designer when form is selected from Project Manager  
  2. Like
    lynkfs got a reaction from IElite in TW3ListMenu selection   
    procedure TForm1.InitializeObject;
    begin
      inherited;
      {$I 'Form1:impl'}
      for var i := 0 to 4 do begin
        var item := W3ListMenu1.AddTextItem('menu ' + inttostr(i));
        item.TagValue := W3ListMenu1.Count-1;
        item.OnClick := procedure(Sender:TObject)
        begin
          writeln((sender as TW3ListMenuItemText).TagValue);
        end;
      end;
    end;
  3. Like
    lynkfs reacted to warleyalex in SMS and MORMOT   
    You can invoke a webservice created with MORMot to perform the authentication and call some services, thanks to suberb work by Arnauld Bouchez http://blog.synopse.info/post/2014/08/11/CrossPlatform-Clients/SmartMobileStudio, interface-based service can be accessed via a SmartPascal for instance, this classes are 100% smart pascal code compatible, just to prove the power the smart pascal. You can use even the SMS Basic version, but you don't have support from the desginer, you basically have to create the views and binding using the controllers (smart units), the point is you don't need to pay the Enterprese edition to consume mORMot services, of couse the professional editions is recommended.
    I can't believe SMS didn't put this feature info into https://smartmobilestudio.com/feature-matrix/,  IMHO it may be a good selling point for SmartMobileStudio.
    The super-robo-architect AB has designed the units for months... I still can not believe it today, SMS didn't give due value to the super-robo-architect. Some months writting some the lib, the units will be generated directly from the mORMot server, there is no package to be installed within the SMS IDE, there is no wrappers involved, the clients are 100% written in smart pascal dialect. to enable/generate the smartmobilestudio wrapper class, just go to http://127.0.0.1:888/root/wrapper and paste into smart mobile studio for news projects.   Smart Mobile Studio with mORMot is very interesting!  
  4. Like
    lynkfs reacted to MikeR in Recommendations for Graphics work   
    Did some preliminary research. Here is an example of 2-way comms between a C# Winforms program and an embedded HTML-script-capable browser window:
    https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.webbrowser.objectforscripting?view=netframework-4.7.2
    I ran this code in VS2017 and it works just fine. Video attached.
     
    2-way comms_20181210160234.mp4
  5. Like
    lynkfs reacted to jarto in CSS Resource Files   
    As you use the default theme, it gets copied as res/app.css every time you compile. Also, the compiler adds this to the head of the html-file:
    <link rel="stylesheet" type="text/css" href="res/app.css"/> If you write your own styles for your components, you can create a separate css file just like you have done and use it with TW3Storage.LoadCSS or the function I wrote above. They both add the same kind of stylesheet-link to the html-file.
    I can't reproduce the caching. Let's see if we are doing everything the same way.
    I added MyTestControl.css to the Resources section. The file itself is in the project's own folder and NOT www/res.

    Once I compile, the file gets copied to www/res/MyTestControl.css
    During startup of my app, I load the css with TW3Storage.LoadCSS. I run it and see my style.
    The css-resource is currently an unknown type for the IDE, so I can't edit it in the IDE. I open the file in Notepad++ and change something + save.
    I hit Compile again and Execute and I do see the changes that I made.
  6. Like
    lynkfs reacted to IgorSavkic in SMS and MORMOT   
    > 1. Does the current version of MS support mormot (ver 18)?
    In mORMot, last fully supported version of SMS is 2.2.2.4543, I think at this moment ab (mORMot) doesn't have plans of adding support for SMS 3.0. I don't know if SMS team have plans for that. What would be required is changing SMS mustache template in mORMot, I reckon 1 to 3 days of work for a regular user (like myself).
    > 2. If not, if I purchase SMS, can I download a version that does?
    At the moment what should work is using latest mORMot for server side and some older one for SMS (to generate mORMotClient unit).
  7. Thanks
    lynkfs got a reaction from MikeR in Recommendations for Graphics work   
    I have not been involved in anything similar, but looks like an interesting project. 
    Out of the box SMS supports WebGL, which renders interactive 3D and 2D graphics within browsers without the need for additional libraries. However probably too low-level to consider.
    Alternatively find and select a suitable javascript library (Vis.js ? Plot.ly ? three.js ?). Basically any javascript library can be made to run under SMS control and even when not pre-wrapped it is usually not too hard to use them.
    To illustrate that point the snippet below executes a method from Googles TensorFlow.js neural network library. The commented line is the TensorFlow function call in javascript syntax, which is translated underneath in object pascal syntax (in this case using an anonymous class)
          // model.add(tf.layers.dense({units: 10, activation: 'sigmoid',inputShape: [2]}));       model.add(tf.layers.dense(class         units = 10;         activation = 'sigmoid';         inputShape : array[0..0] of integer = [2];       end));  
    Would be interested to see how you would set up the 2-way communication between the desktop app and the browser window.
     
  8. Like
    lynkfs got a reaction from jarto in Recommendations for Graphics work   
    I have not been involved in anything similar, but looks like an interesting project. 
    Out of the box SMS supports WebGL, which renders interactive 3D and 2D graphics within browsers without the need for additional libraries. However probably too low-level to consider.
    Alternatively find and select a suitable javascript library (Vis.js ? Plot.ly ? three.js ?). Basically any javascript library can be made to run under SMS control and even when not pre-wrapped it is usually not too hard to use them.
    To illustrate that point the snippet below executes a method from Googles TensorFlow.js neural network library. The commented line is the TensorFlow function call in javascript syntax, which is translated underneath in object pascal syntax (in this case using an anonymous class)
          // model.add(tf.layers.dense({units: 10, activation: 'sigmoid',inputShape: [2]}));       model.add(tf.layers.dense(class         units = 10;         activation = 'sigmoid';         inputShape : array[0..0] of integer = [2];       end));  
    Would be interested to see how you would set up the 2-way communication between the desktop app and the browser window.
     
  9. Like
    lynkfs reacted to jarto in New to Node   
    Actually, the communication part between a NodeJS server and a Smart client app is pretty easy.
    Client: You read data from the server using simple http/https get. When you want to write something to the server, you do it with http/https post.
    Server: You can start with the NodeJS http server example. When your client sends a get or post, it comes to TServer.HandleRequest where you handle the request.
    You can start by adding some WriteLn to TServer.HandleRequest to print out what the headers and the content is. Then you can send GET and POST requests to it by using a browser (http://localhost:1881/whatever/url/you/want/to/send/it?params=whatever) or curl. With Curl you can easily send post commands. For example:
    curl -i -X POST -H 'Content-Type: application/json' -d '{"score": "Player": "10000"}' http://localhost:1881
    When you can see what's going on in the server, you can also make the client app and start sending those http get/post with TW3HttpRequest (SmartCL.Net.Http)
    I have done this earlier on the client side with Smart Mobile Studio and it worked nicely. There were hundreds of thousands of users on iOS and Android. The server was in Delphi but it can really be written in any language. I'd probably write my next server in Smart Mobile Studio using NodeJS.
  10. Like
    lynkfs reacted to IElite in TSpinButton? TSpinEdit?   
    attached is an updated version of the source code
    I created a TW3SpinBtn class derived from TW3Button - for the Up and Down buttons, then exposed them so users can change the buttons style anyway they like.

     
     
    This way, your not forced to use the same icon, color, etc.
     
    SpinBtn.pas
  11. Thanks
    lynkfs got a reaction from IgorSavkic in 5-minute with SMS 3.1.0.75 overview   
    Having a look at what a simple Vue control involves : the first part of this article describes how to make a vue button
    Apparently a new SMS Vue button customcontrol needs to
    define the component in vue terms    (the 'Vue.component' bit in the article) emit html that vue can hook in to       (the 'div id="components-demo" bit) get styling done through class based css and then needs to be run under Vue control (the 'new Vue({ el: '#components-demo' }) bit)
    Ad 1 : this is completely different from present component coding practices.
    Ad 2 : this is much the same as coding a new SMS customcontrol.
    Ad 3 : this is exactly the same as current styling is done in SMS.
    From this example it looks like it would be technically feasible to make up a bunch of hybrid SMS/Vue components
    Organising them in an application under Vue control does deviate from current SMS development though.
     
    Still struggling with the question of what problem this approach is a solution for
    edited :
    model-view data binding which is offered by Vue is a good thing of course, but can be done in other ways as well 
     
     
     
     
     
     
  12. Like
    lynkfs got a reaction from jarto in 5-minute with SMS 3.1.0.75 overview   
    I guess I'm personally a bit of an anti-frameworker. I find that every new framework has a (steep) learning curve and unexpected behaviours which needs to be dealt with. Besides, it usually is virtually impossible to change third-party frameworks/libraries to your own needs.
    So I tend to go back to basics as much as possible.
    As to Vue, I can't really comment on the +'s or -'s. It certainly is a large framework which goes way beyond simply providing a collection of visual components.
    In the end it will be feasible I guess to integrate Vue in SMS. Almost everything is possible.
    A minimal proof of concept : 
     
    var document external 'document': variant; var console  external 'console':  variant; implementation { TForm1 } procedure TForm1.W3Button1Click(Sender: TObject); begin   var Script := document.createElement('script');   Script.src := 'https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js';   document.head.appendChild(Script);   Script.onload := procedure   begin     console.log('Vue loaded');     var el := '#' + W3Button1.handle.id;     var template := '<div>Hello World</div>';     asm var vm = new Vue({@el, @template}); end; end; or with one-way binding :
    var el := '#' + W3Button1.handle.id; W3Button1.handle.innerHTML := '{{ message }}'; var data := class message = 'Hello Vue'; end; asm var vm = new Vue({el: @el, data: @data}); end; //which is equivalent to : // W3Button1.Caption := 'Hello Vue'; (project, demo)
    does it serve a purpose ? the question is 'does it solve a problem'. 
    Not convinced.
     
     
  13. Like
    lynkfs got a reaction from IgorSavkic in 5-minute with SMS 3.1.0.75 overview   
    I guess I'm personally a bit of an anti-frameworker. I find that every new framework has a (steep) learning curve and unexpected behaviours which needs to be dealt with. Besides, it usually is virtually impossible to change third-party frameworks/libraries to your own needs.
    So I tend to go back to basics as much as possible.
    As to Vue, I can't really comment on the +'s or -'s. It certainly is a large framework which goes way beyond simply providing a collection of visual components.
    In the end it will be feasible I guess to integrate Vue in SMS. Almost everything is possible.
    A minimal proof of concept : 
     
    var document external 'document': variant; var console  external 'console':  variant; implementation { TForm1 } procedure TForm1.W3Button1Click(Sender: TObject); begin   var Script := document.createElement('script');   Script.src := 'https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js';   document.head.appendChild(Script);   Script.onload := procedure   begin     console.log('Vue loaded');     var el := '#' + W3Button1.handle.id;     var template := '<div>Hello World</div>';     asm var vm = new Vue({@el, @template}); end; end; or with one-way binding :
    var el := '#' + W3Button1.handle.id; W3Button1.handle.innerHTML := '{{ message }}'; var data := class message = 'Hello Vue'; end; asm var vm = new Vue({el: @el, data: @data}); end; //which is equivalent to : // W3Button1.Caption := 'Hello Vue'; (project, demo)
    does it serve a purpose ? the question is 'does it solve a problem'. 
    Not convinced.
     
     
  14. Like
    lynkfs got a reaction from Czar in wysiwyg   
    something like this (with more commands) would be possible
    procedure TForm1.InitializeObject; begin   inherited;   {$I 'Form1:impl'}   W3IFrameHtmlElement1.src := 'https://www.lynkfs.com/Experiments/wysiwyg/'; end;  
  15. Like
    lynkfs reacted to IElite in 5-minute with SMS 3.1.0.75 overview   
    @jarto
    as in my statement above, I could not get it to work for me. see attached image.
    this is what I originally had
    <Files>         <File>           <Name>testcomp</Name>           <MediaType>text/pascal</MediaType>           <External>C:\Users\shane\Downloads\Smart\Projects\test6\testcomp.pas</External>         </File>       </Files>     </Code>     <Components>       <Component>         <Name>TMyComponent</Name>         <Category>Sample</Category>         <Glyph>           <Name>TMyComponent</Name>           <MediaType>image/png</MediaType>           <External>Glyphs\TMyComponent.png</External>         </Glyph>       </Component>     </Components> if I follow your steps and put my *.pas file in RTL
     <External>RTL\MyControls\testcomp.pas</External> It works!
    Why wouldn't a full path to my file work?  Why does my file have to be in the RTL (It is not part of the RTL)
    Anyways, its nice to know after all this time what the problem was!  Thanks!!!!
     
     

  16. Thanks
    lynkfs reacted to jarto in 5-minute with SMS 3.1.0.75 overview   
    @EWB Muito obrigado
    If you create a package and register your component in the component palette, the published properties will work automatically in the Object Inspector. When looking at your example,
    This would not show up as the OI does not understand TCustomStyle, but TStrArray does work and show up. Also sets like TMyStyle do work.
    Live preview did not work at all, so it was disabled. In 3.0 I did fix many bad bugs in the designer. So now the designer works, but it's not pretty.
    You're right that he was running too many races at once. When it came to posts he did, Smart Desktop actually does work very well and if you try running it with some dirt cheap Raspberry PI, it delivers very nice performance. So yes, it can be used as a basis for a kiosk or embedded system where costs per device can be extremely low.
    Jon also had a habit of writing blog posts of something he was working on or what will be released in the future. I tried to get him to stop that as it's annoying to not be able to test it yourself.
  17. Like
    lynkfs got a reaction from Czar in wysiwyg   
    Was looking for an easy to make wysiwyg editor. This one is based on 'document.designMode'.
    Mozilla: "When an HTML document has been switched to designMode, its document object exposes an execCommand method to run commands that manipulate the current editable region"
    IFrame's have an innate document element which can be used for that purpose.
    Have a form with an IFrameHtmlElement and 2 buttons ('bold' and 'italic') :
    procedure TForm1.InitializeForm; begin   inherited;   // this is a good place to initialize components   W3IframeHtmlElement1.handle.contentDocument.designMode := 'on';   W3IframeHtmlElement1.handle.contentDocument.body.innerHTML := 'this is some text';   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button1Click(Sender: TObject); //bold begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('bold', false, null);   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button2Click(Sender: TObject); //italic begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('italic', false, null);   W3IframeHtmlElement1.handle.focus(); end; Besides 'bold' and 'italic' execCommand supports a host of other edit commands as well.
    see https://codepen.io/chrisdavidmills/full/gzYjag/
     
     
  18. Like
    lynkfs got a reaction from IElite in wysiwyg   
    Was looking for an easy to make wysiwyg editor. This one is based on 'document.designMode'.
    Mozilla: "When an HTML document has been switched to designMode, its document object exposes an execCommand method to run commands that manipulate the current editable region"
    IFrame's have an innate document element which can be used for that purpose.
    Have a form with an IFrameHtmlElement and 2 buttons ('bold' and 'italic') :
    procedure TForm1.InitializeForm; begin   inherited;   // this is a good place to initialize components   W3IframeHtmlElement1.handle.contentDocument.designMode := 'on';   W3IframeHtmlElement1.handle.contentDocument.body.innerHTML := 'this is some text';   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button1Click(Sender: TObject); //bold begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('bold', false, null);   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button2Click(Sender: TObject); //italic begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('italic', false, null);   W3IframeHtmlElement1.handle.focus(); end; Besides 'bold' and 'italic' execCommand supports a host of other edit commands as well.
    see https://codepen.io/chrisdavidmills/full/gzYjag/
     
     
  19. Like
    lynkfs got a reaction from jarto in wysiwyg   
    Was looking for an easy to make wysiwyg editor. This one is based on 'document.designMode'.
    Mozilla: "When an HTML document has been switched to designMode, its document object exposes an execCommand method to run commands that manipulate the current editable region"
    IFrame's have an innate document element which can be used for that purpose.
    Have a form with an IFrameHtmlElement and 2 buttons ('bold' and 'italic') :
    procedure TForm1.InitializeForm; begin   inherited;   // this is a good place to initialize components   W3IframeHtmlElement1.handle.contentDocument.designMode := 'on';   W3IframeHtmlElement1.handle.contentDocument.body.innerHTML := 'this is some text';   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button1Click(Sender: TObject); //bold begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('bold', false, null);   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button2Click(Sender: TObject); //italic begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('italic', false, null);   W3IframeHtmlElement1.handle.focus(); end; Besides 'bold' and 'italic' execCommand supports a host of other edit commands as well.
    see https://codepen.io/chrisdavidmills/full/gzYjag/
     
     
  20. Like
    lynkfs got a reaction from DavidRM in wysiwyg   
    Was looking for an easy to make wysiwyg editor. This one is based on 'document.designMode'.
    Mozilla: "When an HTML document has been switched to designMode, its document object exposes an execCommand method to run commands that manipulate the current editable region"
    IFrame's have an innate document element which can be used for that purpose.
    Have a form with an IFrameHtmlElement and 2 buttons ('bold' and 'italic') :
    procedure TForm1.InitializeForm; begin   inherited;   // this is a good place to initialize components   W3IframeHtmlElement1.handle.contentDocument.designMode := 'on';   W3IframeHtmlElement1.handle.contentDocument.body.innerHTML := 'this is some text';   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button1Click(Sender: TObject); //bold begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('bold', false, null);   W3IframeHtmlElement1.handle.focus(); end; procedure TForm1.W3Button2Click(Sender: TObject); //italic begin   W3IframeHtmlElement1.handle.contentDocument.execCommand('italic', false, null);   W3IframeHtmlElement1.handle.focus(); end; Besides 'bold' and 'italic' execCommand supports a host of other edit commands as well.
    see https://codepen.io/chrisdavidmills/full/gzYjag/
     
     
  21. Like
    lynkfs got a reaction from jarto in lighthouse   
    Google has implemented a new service : web.dev
    Basically this measures some indicators of any url using their LightHouse tool.
    These indicators are grouped into Performance, Accessibility, Best Practices and SEO
     
    I created a minimal SMS project with only a single image on a form and run the test :
    https://web.dev/measure and url : https://www.lynkfs.com/Experiments/lighthouse/www/
    This gives scores of 95 / 27 / 77 / 89 for Performance, Accessibility, Best Practices and SEO respectively
     
    There are a couple of really simple things which will up these scores considerably.
    Scores were upped to 96 / 74 / 92 / 100 when doing this :
    Best Practices from 77 to 92 :
    1) in project options/linker unclick 'generate cache manifest' (deprecated)
    Performance from 95 to 96 :
    1) in project options/linker unclick 'store CSS as a separate file'  (95 to 96)
    2) add async to <script async src="lib/polyfill.custom.events.js" type="text/javascript"></script> in the index.html template
    SEO from 89 to 100 :
    1) add meta description tag to the head of index.html
    <meta name="Description" content="Put your description here.">
    Accessability from 27 to 74 :
    1) add alt attribute to images, even if only ''  :   W3Image1.handle.setAttribute('alt', ''); (27 to 58)
    2) add lang="en" to html element in index.html template : <html lang="en">   (58 to 74)
    3) tabindex=1 for TW3Display and TW3DisplayView. Should be 0 ?
    run test again on url : https://www.lynkfs.com/Experiments/lighthouse2/www/ to see these results
     
    All of the above could be made part of the standard settings for a new visual project
     
     
  22. Like
    lynkfs got a reaction from IElite in lighthouse   
    Google has implemented a new service : web.dev
    Basically this measures some indicators of any url using their LightHouse tool.
    These indicators are grouped into Performance, Accessibility, Best Practices and SEO
     
    I created a minimal SMS project with only a single image on a form and run the test :
    https://web.dev/measure and url : https://www.lynkfs.com/Experiments/lighthouse/www/
    This gives scores of 95 / 27 / 77 / 89 for Performance, Accessibility, Best Practices and SEO respectively
     
    There are a couple of really simple things which will up these scores considerably.
    Scores were upped to 96 / 74 / 92 / 100 when doing this :
    Best Practices from 77 to 92 :
    1) in project options/linker unclick 'generate cache manifest' (deprecated)
    Performance from 95 to 96 :
    1) in project options/linker unclick 'store CSS as a separate file'  (95 to 96)
    2) add async to <script async src="lib/polyfill.custom.events.js" type="text/javascript"></script> in the index.html template
    SEO from 89 to 100 :
    1) add meta description tag to the head of index.html
    <meta name="Description" content="Put your description here.">
    Accessability from 27 to 74 :
    1) add alt attribute to images, even if only ''  :   W3Image1.handle.setAttribute('alt', ''); (27 to 58)
    2) add lang="en" to html element in index.html template : <html lang="en">   (58 to 74)
    3) tabindex=1 for TW3Display and TW3DisplayView. Should be 0 ?
    run test again on url : https://www.lynkfs.com/Experiments/lighthouse2/www/ to see these results
     
    All of the above could be made part of the standard settings for a new visual project
     
     
  23. Thanks
    lynkfs got a reaction from IgorSavkic in lighthouse   
    Google has implemented a new service : web.dev
    Basically this measures some indicators of any url using their LightHouse tool.
    These indicators are grouped into Performance, Accessibility, Best Practices and SEO
     
    I created a minimal SMS project with only a single image on a form and run the test :
    https://web.dev/measure and url : https://www.lynkfs.com/Experiments/lighthouse/www/
    This gives scores of 95 / 27 / 77 / 89 for Performance, Accessibility, Best Practices and SEO respectively
     
    There are a couple of really simple things which will up these scores considerably.
    Scores were upped to 96 / 74 / 92 / 100 when doing this :
    Best Practices from 77 to 92 :
    1) in project options/linker unclick 'generate cache manifest' (deprecated)
    Performance from 95 to 96 :
    1) in project options/linker unclick 'store CSS as a separate file'  (95 to 96)
    2) add async to <script async src="lib/polyfill.custom.events.js" type="text/javascript"></script> in the index.html template
    SEO from 89 to 100 :
    1) add meta description tag to the head of index.html
    <meta name="Description" content="Put your description here.">
    Accessability from 27 to 74 :
    1) add alt attribute to images, even if only ''  :   W3Image1.handle.setAttribute('alt', ''); (27 to 58)
    2) add lang="en" to html element in index.html template : <html lang="en">   (58 to 74)
    3) tabindex=1 for TW3Display and TW3DisplayView. Should be 0 ?
    run test again on url : https://www.lynkfs.com/Experiments/lighthouse2/www/ to see these results
     
    All of the above could be made part of the standard settings for a new visual project
     
     
  24. Like
    lynkfs got a reaction from Czar in lighthouse   
    Google has implemented a new service : web.dev
    Basically this measures some indicators of any url using their LightHouse tool.
    These indicators are grouped into Performance, Accessibility, Best Practices and SEO
     
    I created a minimal SMS project with only a single image on a form and run the test :
    https://web.dev/measure and url : https://www.lynkfs.com/Experiments/lighthouse/www/
    This gives scores of 95 / 27 / 77 / 89 for Performance, Accessibility, Best Practices and SEO respectively
     
    There are a couple of really simple things which will up these scores considerably.
    Scores were upped to 96 / 74 / 92 / 100 when doing this :
    Best Practices from 77 to 92 :
    1) in project options/linker unclick 'generate cache manifest' (deprecated)
    Performance from 95 to 96 :
    1) in project options/linker unclick 'store CSS as a separate file'  (95 to 96)
    2) add async to <script async src="lib/polyfill.custom.events.js" type="text/javascript"></script> in the index.html template
    SEO from 89 to 100 :
    1) add meta description tag to the head of index.html
    <meta name="Description" content="Put your description here.">
    Accessability from 27 to 74 :
    1) add alt attribute to images, even if only ''  :   W3Image1.handle.setAttribute('alt', ''); (27 to 58)
    2) add lang="en" to html element in index.html template : <html lang="en">   (58 to 74)
    3) tabindex=1 for TW3Display and TW3DisplayView. Should be 0 ?
    run test again on url : https://www.lynkfs.com/Experiments/lighthouse2/www/ to see these results
     
    All of the above could be made part of the standard settings for a new visual project
     
     
  25. Thanks
    lynkfs got a reaction from Czar in console override   
    This mechanism can be used to redefine more built-in functions. Funny.
    The code below redefines 'ShowMessage' to redirect its contents to a Memo :
    procedure TForm1.InitializeObject; begin   inherited;   {$I 'Form1:impl'}   W3Memo1.Text := 'ShowMessage : ' + #10;   browserapi.window.alert := procedure(text:variant)   begin     W3Memo1.Text := W3Memo1.Text + #10 + text;   end;   ShowMessage('ccc');   browserapi.window.alert('ddd'); end;  
    or combine the two and redefine 'ShowMessage' to redirect its contents to the 'Writeln' function, which in its turn is redirected to the Memo :
    procedure TForm1.InitializeObject; begin   inherited;   {$I 'Form1:impl'}   W3Memo1.Text := 'Console.log : ' + #10; //WriteLn redirects to Memo   browserapi.console.log := procedure(text:variant)   begin     W3Memo1.Text := W3Memo1.Text + #10 + text;   end; //ShowMessage redirects to WriteLn   browserapi.window.alert := procedure(text:variant)   begin     writeln(text);   end;   writeln('aaa');   browserapi.console.log('bbb');   ShowMessage('ccc');   browserapi.window.alert('ddd'); end;  
×
×
  • Create New...