Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by lynkfs

  1. a quicky calendar : function jQuery(aTagObj: TW3TagObj): Variant; function jQueryExternal(v: Variant): Variant; external '$'; implementation { TForm1 } function jQuery(aTagObj: TW3TagObj): Variant; begin result := jQueryExternal(aTagObj.handle); end; procedure TForm1.InitializeForm; begin inherited; // this is a good place to initialize components MyBox := TW3EditBox.Create(self); MyBox.Text := 'Date'; MyBox.SetBounds(20,20,200,40); var props : Variant := TVariant.Create; props['dateFormat'] := 'dd/mm/yy'; jQuery( MyBox ).datepicker(props); // or alternatively //
  2. there seems to be a problem with the search facility on the forum : Something went wrong. Please try again. Error code: EX-1
  3. lynkfs


    pushing as much as possible towards the holy grail we'll see...
  4. lynkfs


    I had an idea of how to approach the concept of a 'no-code' / 'lo-code' framework, which involved a modelling exercise done from different viewpoints. The idea was to base this on a graph-based domain model and some defined aspect-models derived from that. The following link contains bit of a write-up : preamble, framework basics, domain model, data model, process model, beginnings of workflow model. Event-, processor- and objectives model unfinished. demo showing how the design efforts of these models might look like (in broad terms) demo of how the generated app from
  5. Pity Jon quit from Smart but I'm sure he has made the choice he did in his best interests. I would like to say thank you to Jon for the huge investment he made in developing Smart Mobile Studio and the support and r&d of same. I hitched along since version 0.x and have enjoyed it ever since. Warm regards
  6. every time you add a row, fill the tagid of the row with the row number. TagId is a field (string) present in all component descendants in which you can save things. Then in an onclick handler read that field to retrieve the clicked on rownr. (MyGrid.Row[MyGrid.LastAddedRow] as TW3CustomControl).TagId := inttostr(MyGrid.LastAddedRow); (MyGrid.Row[MyGrid.LastAddedRow] as TW3CustomControl).onClick := procedure(sender:TObject)  begin browserapi.window.alert((Sender as TW3CustomControl).TagId); end; (Alternatively you can use the data- attribute as temporary s
  7. If you're using the 'featured demos / node.js / http server example' project, then the output you're getting is correct. procedure TServer.HandleRequest(Sender: TObject; const Request: TNJHttpRequest; const Response: TNJHttpResponse); begin // Just end the request by sending the headers back as a string response.&End('hello world' + request.Headers.ToString()); end; its just the headers you get returned.
  8. lynkfs

    state machine

    A finite state machine. The FSM implemented below is taken from this article, which explains link between event based UX and FSM. Worthwhile reading. Every state is an object and has one or more actions associated. The implementation here uses messaging, which makes it much simpler. type idle = class procedure click(caption:string); Button: TW3Button; end; type fetch = class procedure fetchResult; procedure Success; procedure Error; end; type error = class procedure retry; end; type TForm1 = class(TW3Form) private {$I 'Form1:
  9. see if this helps you out unit Form1; interface uses System.Types, System.Types.Convert, System.Objects, System.Time, SmartCL.System, SmartCL.Time, SmartCL.Graphics, SmartCL.Components, SmartCL.FileUtils, SmartCL.Forms, SmartCL.Fonts, SmartCL.Theme, SmartCL.Borders, SmartCL.Application, SmartCL.Controls.RadioGroup, SmartCL.Controls.RadioButton, System.Colors; type TForm1 = class(TW3Form) private {$I 'Form1:intf'} protected procedure InitializeForm; override; procedure InitializeObject; override; procedure Resize; override; RadioGr
  10. Some html elements are notoriously difficult to style, and browsers have all kind of different ways of doing it anyway. A good article : https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Advanced_styling_for_HTML_forms In the native framework I opted for completely bypassing the browsers antics and make my own. In the end a radio button group can be as simple as a panel with a number of radio buttons (which can be panels as well with rounded corners) and associated labels. Not suggesting you should follow that road, but if it helps here is the component code I used ther
  11. lynkfs


    I would have a look at fully developed open source calendar js libraries which can be embedded in your sms app as is (i.e. https://fullcalendar.io/) make your own based on an opensource css-only component. These components usually have no js component at all, just html and css. The css bit you can copy into your stylesheet if you like the look and feel and the html can be used to recreate the logic behind it all. (i.e. https://freefrontend.com/css-calendars/) make your own from scratch my personal approach would be the middle one (unless you find a js library which does
  12. lynkfs

    Send an email ?

    a "smarted" up example of sending gmails using the gmail client library (replaces html file of option 2a previous post) a form with 3 buttons (button1 : log in / button2: log out / button3 : send gmail) .... 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.setAtt
  13. lynkfs

    Send an email ?

    This is a 2-step process 1) see this post and follow at least the first steps. Basically establish the link between your app, googles api's and your gmail account. For option 2a(below) you need at least an api-key and clientId, for option 2b you need the full oauth2 gamut including tokens 2) then do one of the following 2a) make use of Googles javascript client library for gmail <!DOCTYPE html> <html> <head> <title>Send email using gmail API</title> <meta charset='utf-8' /> </head> <body> <p>
  14. lynkfs

    Send an email ?

    to send emails you need a server side provider (except when you're ok with using mailto: which directs the browser to use the main installed emailclient (if any). all of the major parties provide an email api (google, amazon) which you can hook in to Some of the not so major companies are emailjs.com, mailgun, smtpjs and probably many more. Their services are accessable from js based clients or have your own server based on node (nodemailer) or php (mail) I usually use a php solution as I have this installed and the script to use is really simple, but have used the Google a
  15. Edited : You can use the scrollTop variable to do programmatic scrolling Have a form with a panel and a button : type TForm1 = class(TW3Form) procedure W3Button1Click(Sender: TObject); private {$I 'Form1:intf'} protected procedure InitializeForm; override; procedure InitializeObject; override; procedure Resize; override; PageNr : integer := 0; end; implementation { TForm1 } procedure TForm1.W3Button1Click(Sender: TObject); begin W3Panel1.handle.scrollTop := W3Panel1.height * INC(PageNr); //every buttonclick scrolls panel end; procedure TForm
  16. the problem is in your UpdateUI proc this works : FMessageLabel.Caption := FMessageText; tMetrics := FMessageLabel.MeasureText(FMessageText); FMessageLabel.SetSize(tMetrics.tmWidth, Round(tMetrics.tmHeight * 1.5)); FMessageLabel.Top := padding; FMessageLabel.Left := padding; //FMessagePanel.Width := FMessageLabel.Width + padding * 4 + margin * 2 + border * 2; FMessagePanel.Width := tMetrics.tmWidth + padding * 4 + margin * 2 + border * 2; //FMessagePanel.Height := FMessageLabel.Height + padding * 4 + margin * 2 + border * 2; FMessagePanel.Height := tMetrics.tmHeigh
  17. the canvas font property is the same as the css font property : it is a shorthand form for specifying 'font-family', 'font-size', 'font-style', 'font-variant' and 'font-weight' in 1 statement. so "font: bold 24px verdana" specifies font-weight, font-size and font-family. all possible font attribute values at https://developer.mozilla.org/en-US/docs/Web/CSS/font and .../font-family
  18. yep if you google 'canvas font shadow' or 'canvas font effects' you'll get plenty of links to what effects you can achieve with text on canvas. All of these are doable in SMS. To get really out there, have a look at blotter.js - a library which allows you to create amazing text on canvas effects https://codepen.io/RMKNGY/pen/bKJxvd
  19. quick search 1) links which state there is a problem on edge with the anchor tag and download attribute https://caniuse.com/#feat=download https://stackoverflow.com/questions/18394871/download-attribute-on-a-tag-not-working-in-ie https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14603958/ 2) link which states that it all should work on edge. However look at the 'known issues' tab https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7260192/ 3) link with a possible solution, which will require some work before it is usable https://catonrug.blogs
  20. amazing app ? - looks absolutely wonderful As to Edge, I don't know why these guys (MS) bother at all In my experience Edge is completely buggy (latest : doesn't even allow localStorage on win10) and is far behind implementing even the simplest of html5 / w3c specs (detail/summary tags, doh) Edge is the new IE (I'll have a look later if there is a workaround) Cheers
  21. is this what you're after ? Forms, when declared 'external' in the project manager in the ide, consist of a .pas and a .smf file (when declared 'internal' the files are embedded in the .sproj project file). Copying both form files to a new project effectively copies that form (probably easiest if you declare the new form in the new project first and then do the copying)
  22. you can use a simple IFrameHtmlElement on a form and set src to something like this W3IFrameHtmlElement1.Src := "//www.openstreetmap.org/export/embed.html?bbox=10.970685482025146%2C49.5968664515866%2C10.98160743713379%2C49.603138573344914&layer=mapnik&marker=49.60000261331038%2C10.976146459579468";
  23. lynkfs

    a basic JSON question

    if you include ECMA.Json then you don't need to asm block your parse statements don't know what your TR1 variable is, but define it as a variant. Do a console.log(@TR1); // {"business":"lynkfs","departments":[{"deptname":"marketing","staff":[{"first and after parsing you can access your fields as in TR1.business and TR1.departments[0].deptname etc . Below is what I call my dogs breakfast. Just a set of steps to convert from one data structure to another. Multiple stringify's and parse's in there step 1 : create a record structure step2 : change some val
  24. I've noticed the inconsistent measuretext function too. However in your case you can use textAlign in the canvas LBitmap.Canvas.Context.DC.textAlign := 'right'; LBitmap.Canvas.TextOut(400, 70, s, clwhite); //400-wdth
  25. lynkfs

    memo lines ?

    interesting. Basically you would need to keep Text(string) and Lines(array of string) in sync at all times, and only sync when data changes in either one of them I suppose you could define a Lines array, and override the js push method (for this array only) Lines = [] Lines.push = function(data) { ... update Memo.text with data .... return Array.prototype.push.call(this, data); } and in this override update Memo.Text (or re-create Text from Lines). That would cover the use case of Memo1.Lines.Add(data) and I suppose similarly for deletes. The other way around (changing Te
  • Create New...