Jump to content

lynkfs

Moderators
  • Content Count

    743
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by lynkfs

  1. lynkfs

    printing

    Printers used to be dumb peripherals. Not so with the latest receipt printers (epson). They have actually an apache webserver built in, and the printer can act as the hub for displays, scanners and other (dumb) peripherals. amazing. Connecting them to Smart looks like not too difficult.
  2. lynkfs

    printing

    I need to print receipts from a webpage (intranet). The difficulty is not so much to get a print happening on some printer, but to do it in such a way that the usual printer selection dialog gets bypassed. So basically a form with a print button which, when pressed, prints a receipt to a designated printer straightaway, without every time asking the user to select a printer. The normal print methods (window.print(), google cloud print, external print.js libraries) do not solve that problem. The only reference I found that might work is the ePOS_SDK from Epson, which can be used with
  3. I accidentally gave a project a reserved name ('implementation'). Not a good idea: compiles then crashes
  4. lynkfs

    Treeview

    or use the built-in TreeWalker
  5. lynkfs

    Treeview

    There is a treeview component in the 'native rtl' (demo, docum) See 'JTreeView' under 'Components' in the demo usage: var TreeView1 := JW3TreeView.Create(self); TreeView1.SetBounds(0, 0, 250, 200); TreeView1.Subject := 'Job roles'; TreeView1.Add('ceo','','chief executive officer'); //root TreeView1.Add('cto', 'ceo','chief technology officer'); TreeView1.Add('dev1', 'cto','developer 1'); TreeView1.Add('dev2', 'cto','developer 2'); TreeView1.Add('dev3', 'cto','developer 3'); TreeView1.Add('assistent', 'dev2','assistant developer 2'); T
  6. You're pushing the boundaries here and probably too far if you want to write directly from a client. If you only need to read a file you can do that in a couple of ways, see this post Otherwise also have a look at SmartCL.Require.pas, this article, this post and this post and even https://nwjs.io/ to see if that helps in any way. Keep us posted
  7. Reading up a bit on web design systems Basically web design systems are a collection of rules, components, tools etc helping developers to create a consistent look and feel for the websites or apps they are developing. This link links to the design system of the us gov. Whether or not one likes this system, it is certainly comprehensive. As an example I quite like f.i this site which conforms to these rules.
  8. lynkfs

    menu component

    Probably not the most inspiring topic, but just sharing a menu component I needed for some project. There are quite a few css based menu components around, but I wanted to have a pure smart one. This one has an unlimited number of submenus and is instantiated as a hamburger menu on a toolbar Hamburger := TCHMenu.Create(self); //nodes : id,parent,description,procedure Hamburger.Add('root','','Hamburger menu'); //root Hamburger.Add( 'projects','root','Projects'); Hamburger.Add( 'project0','projects','New project'); Hamburger.Add( 'project1','projects'
  9. Full kudo's to @warleyalex, he was the first one to come up with a working promise unit (see link in post) My posts are usually a personal discovery journey, so I started with the api docs and went from there. There are a couple of differences I've noticed, probably because of different source material or for other reasons. I've asked him.
  10. Promises are a javascript construct enabling async processes to be written in a synchronous manner (sort of). The status quo at this stage : - Promises are part of javascript since Ecmascript 6 - Promises are enabled in all major browsers - Promises work in node.js too (require('promise')) - Promises are not used in the rtl, or described in Smart documentation - There have been some posts on the forum re implementing promises (the best one : ) - The ecma.promise unit in the rtl is based on an older, incompatible, version of the current spec The subject of this post is t
  11. (edited ) I would say either one of the following : if you execute this from file, you will get an error message in the dev console something like this (on chrome) "Access to XMLHttpRequest at 'file:///C:/.../res/apps.ini' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https" and/or your get call should be replaced by something like var FHttp := TW3HttpRequest.Create; FHttp.OnDataReady := lambda writeln(FHttp.responsetext); end; FHttp.open('GET','res/textfile.txt');
  12. lynkfs

    fetching files

    @warleyalex posted another variant a while ago using his (working) promises unit question : is the ECMA.Promise unit fixed ?
  13. lynkfs

    fetching files

    There are afaik 3 ways to read external files directly from the client : using ajax / xmlhttprequest using the filereader using the fetch api 1: get xmlhttprequest var FHttp := TW3HttpRequest.Create; FHttp.OnDataReady := lambda writeln(FHttp.responsetext); end; FHttp.open('GET','res/textfile.txt'); FHttp.send(); 2: file input W3EditBox1.InputType := itFile; W3EditBox1.Handle.ReadyExecute( procedure () begin W3EditBox1.OnChanged := procedure(sender:TObject) begin var reader: variant; asm @reader = new FileReade
  14. lynkfs

    tree walking

    Modern browsers have an enormous number of built-in functions, sometimes very handy These ones, having to do with tree handling, came up the other day : domParsing, nodeIteration and treeWalking The built in domParser function takes a tree in html/dom or xml format : <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer''s Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>
  15. lynkfs

    css grid

    2) using css grid to make a responsive 'form' The below component does some simple layouting of controls and also reacts to screen-sizing, both using the css grid : procedure TForm1.InitializeForm; begin inherited; // this is a good place to initialize components var ResponsiveForm : TResponsiveForm := TResponsiveForm.Create(self); ResponsiveForm.SetBounds(40,40,500,220); ResponsiveForm.AutoHeight := true; ResponsiveForm.Add('Name',TW3EditBox); ResponsiveForm.Add('Email',TW3EditBox); ResponsiveForm.Add('Township',TW3EditBox); ResponsiveForm.Add('Comments',TW3Memo);
  16. lynkfs

    php

    A web application ends up being encoded in html, js and css. php is a language which can be used to create these components, but more importantly can also be used within all 3 of these types of files. That gives some interesting possibilities. To make that happen, php needs to be activated serverside. Many server hosting environments come with php pre-installed. Activating php so that it can be used at the time of serving regular .html, .js or .css files by the browser depends on the type of server. Regular unix based servers make use of a .htaccess file which needs a line like
  17. lynkfs

    window component

    found the problem : the js events give a window based coordinate (e.clientX), while the Smart events give a component based coordinate (x as in left relative to component). Solution : just ad water (just ad component.left) if Ctrl.Cursor=crMove then begin x := x + left; y := y + top; or something like that
  18. lynkfs

    window component

    mmm your amended code (when applied to this or any other visual component) makes for very jittery dragging substituting code with this (below) gives a very smooth movement header.OnAllMovement := procedure(Sender: TObject; dx,dy: Integer) begin left := left + dx; top := top + dy; end; but that wasn't the point. Any idea what causes the jitteryness ? Edit1 : the x,y values in OnMouseMove don't make much sense
  19. lynkfs

    window component

    demo works ok here The javascriptisch events used are //Move window Header.handle.onmousedown := procedure(e: variant) begin Header.handle.style.cursor := 'move'; var saveX := e.clientX; var saveY := e.clientY; Header.handle.onmousemove := procedure(e: variant) begin self.left := self.Left - (saveX - e.clientX); self.top := self.top - (saveY - e.clientY); PrevSize := TRect.CreateSized(left, top, width, height); saveX := e.clientX; saveY := e.clientY; end; end; // Header.handle.onmouseup := procedure(e: vari
  20. lynkfs

    window component

    Thanks. Never had a good look at the event manager. Better do that (problem fixed by the way)
  21. lynkfs

    window component

    no drag racing ... fixable (when time permits)
  22. Just in case anyone has a need for a window component. (multiple windows, movable, resizable, bringtofront, minimise, close, maximise) project
  23. lynkfs

    css grid

    The CSS Grid is pretty fast. However the current major browsers have a hard-coded limit of 1000 rows (Chromium) or 10,000 rows (Firefox). See reference issue here Edited project here (better stylesheet handling)
  24. lynkfs

    css grid

    Started to do some experiments with CSS Grid Basically CSS Grid is a grid component built into all modern browsers, including mobile. The good thing about it is it can be used as a simple grid, as a layout mechanism for forms or other components and can be used to be responsive to screen sizes. 1) A simple grid. Since this is based on css, it can only be teased into life by manipulating the stylesheet. Either by just adding css to it manually or doing it in code : //add some styles in code var s1 := #' .TGrid { display: grid; grid-template-columns: repeat(3, au
  25. lynkfs

    reCaptcha

    as @IgorSavkic pointed out, there are many options and use cases for this api. I think this is the most common one. The funny thing is that even doing only step 1 (displaying the widget with the selection of pictures of bridges, buses etc) and not even doing step 2 (the back-end check) gives some kind of spammer protection. I suspect quite a few websites do it that way
×
×
  • Create New...