Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. lynkfs

    font choice

    Styling on the web is really messy, and takes a lot of effort to get it right. 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)
  3. @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 construct triggers BOTH of the async callbacks Obviously not good. This is either a subtle compiler problem or an elusive scope issue A middle ground approach though works again as expected : SuccessProc := function(value:variant) : variant begin writeln('success'); end; ErrorProc := function(value:variant) : variant begin writeln('error'); end; mypromise.then(procedure(Value: Variant) begin SuccessProc(Value) end, procedure(err: Variant) begin ErrorProc(err) end); (here using the rtl-api-ecma-Ecma.promise unit)
  4. @lynkfs Oh, that helped so much! I've struggled at the concept of calling these external js apis when class references don't exists and also had no experience with using promises. But you helped me get going and now I'm making very good progress 🙂 Now I have TW3FacebookLogin- and TW3GoogleLogin-classes that both work. I'll have to read up a bit to add the necessary parameters (besides ClientId of the app), but I should be able to get them into alpha and component palette next week.
  5. Yesterday
  6. 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'); // // Load the API client and auth2 library gapi.load('auth2', procedure begin var mypromise : variant; mypromise := gapi.auth2.init(class clientId = '..........s0m9qrp8u2m6dcivi8p09tu5se.apps.googleusercontent.com'; end); mypromise.then(procedure begin console.log(mypromise.isSignedIn.get()); end, procedure begin console.log('error'); end); end); end; end; logs 'loaded' and 'true' your other link does specify useful functions which can be added to the above
  7. Last week
  8. @lynkfs It doesn't seem to use the platform api.
  9. @JimKueneman No, I haven't changed anything in WebSockets code.
  10. Does anyone have a working example of how to use Google's Sign-In api via their platform.js? I can find documentation and js code: https://developers.google.com/identity/sign-in/web/sign-in https://www.intricatecloud.io/2019/07/adding-google-sign-in-to-your-webapp-using-the-js-library/ ...but as I'm not at all used to using promises, I feel there's quite a learning curve here for me. With a working example I could turn it into an easy-to-use component in no time.
  11. Did something change in the WebSocket code? I had a project working on an earlier Alpha (don't recall which one) and I updated to the latest. Now when I call connect my server sees the connection and makes it but the callback never is called now. Couple of weird things I observe: 1) I was using this: procedure TTabSettingsForm.W3ButtonConnectionClick(Sender: TObject); var URL: string; begin if FSocket.Connected or FConnected then begin FSocket.Disconnect( procedure (Socket: TW3WebSocket; Success: boolean) <<<< No Blue dots in IDE from here to begin if Success then begin W3ButtonConnection.Caption := 'Connect'; W3ButtonStartNode.Enabled := False; end else begin W3ButtonConnection.Caption := 'Disconnect'; W3ButtonStartNode.Enabled := True; end; end ) end else begin <<<<< Here So I created a callback function explicitly end else begin URL := 'ws://' + W3EditBoxIpAddress.Text + ':' + W3EditBoxIpPort.Text; try if W3CheckBoxTcp.Checked then FSocket.BinaryMessageDataType := wdtArrayBuffer; FSocket.Connect(URL, ['openlcb.websocket'], @WebSocketConnectCallback); procedure TTabSettingsForm.WebSocketConnectCallback(Socket: TW3WebSocket; Success: Boolean); begin if Success then begin W3ButtonConnection.Caption := 'Disconnect'; W3ButtonStartNode.Enabled := True; // W3ButtonStartNodeClick(W3ButtonStartNode); end else begin W3ButtonConnection.Caption := 'Connect'; W3ButtonStartNode.Enabled := False; end; end; Now it has blue dots on all the code but this function is never called even though the server says there is a connection. Jim
  12. Earlier
  13. Yep, got it working nicely. I'm in the process of writing this into a non-visual component, which can be added to the component palette.
  14. I thought I'd test this. When I try to compile, I get an error in FaceBook.SDK.pas: Syntax Error: Class "JFBUIParams" isn't defined completely [line: 15, column: 35, file: FaceBook.SDK] Edit: Got the SDK to compile by changing into this: JFBUIParams = class external end;
  15. A new update is available: IDE: When a property is changed, the IDE adds the required unit into uses clauses. RTL: Bug fix to TRESTCall: Call OnRemove only if it is assigned.
  16. jarto


    Well, that was easy. I was able to get the required unit from DWS, so the IDE adds it dynamically. @lynkfs The 4.0 is the current alpha + some fixes that I have not committed yet. Suggestions are welcome for any other fixes/small improvements. In the situation we are now, I don't want to delay the release too much by taking on something too big.
  17. lynkfs


    Glad you're back Could you elaborate on the upcoming 4.0 ?
  18. jarto


    Thank you for having patience with me and the support 🙂 I just took the kids to school. First day since we returned home. Eager to get the new version released. Here's what needs to be done: Waiting for a new signing dongle for the executables. Solve a small problem with having the right units in the uses-clause when we use TW3ScrollBox or a component that is derived from it. This is mainly about the scroll bar type. I either change the IDE or move the definition of TW3ScrollBarType to another unit. First I'll have a look if DWS will give me enough information so that I can dynamically add the right unit in the IDE. I gave this a try half a year ago, but did not manage to do it then. However, it'd be the best solution by far. If that does not work, it'd possible to have an internal list of types and what units they require. It's not elegant, so I'd like to avoid that as far as I can. The other way to solve this is to simply start using SmartCL.Types.pas and move the defintion there. At the moment it's an empty unit, which makes me think that the plan was originally to have them there. This is not a really optimal solution as that unit would need to be added to old projects to get them to compile.
  19. I will use that instead, thanks for the suggestion
  20. 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)"
  21. w3panel1.zoom := 1.5 works fine in browsers like chrome but completely ignored and 0 in Firefox. Could it be fixed or at default to 1?
  22. IElite


    I think the Pandemic has thrown a Monkey Wrench into everyone's lives. Family comes first!
  23. Hi all, as you probably have noticed, I've been very quiet lately. When COVID-19 spread around the world, the restrictions hit my personal life pretty hard. In UAE, all the schools were closed very early and remained closed all the way to the end of the semester. There was also a strict lock down and lots of restrictions. Doing a lock down with three small children and having to home school them basically meant that my chances of spending many hours of time on development went to nil. Luckily it seems like the schools will open in 3 weeks, which should give me a possibility to concentrate on development again. My plan is to get 3.0 out then.
  24. thank you so much warleyalex! Perfect.
  25. FRepliedSearchCriteria.SetLength(20); console.log( JSON.Stringify(Variant(FRepliedSearchCriteria)) );
  26. Is this possible: type TLccSearchReplyRec = record SearchData: DWORD; NodeID: word; // TNodeID; NodeAlias: Word; HasSTNIP: Boolean; STNIP: string; // TLccSTNIP; end; TLccSearchResultsArray = array of TLccSearchReplyRec; var FRepliedSearchCriteria: TLccSearchResultsArray; begin SetLength(FRepliedSearchCriteria, 20); ..... Syntax Error: Argument 0 expects type "String" instead of "array of record TLccSearchReplyRec" [line: 637, column: 13, file: lcc_node_controller] I know how to allocate an array of bytes but is there a way to map them to an array of records? A string in a record seems problematic if you are trying to just force the bytes to look like a record.... Jim
  27. With great power comes great responsibility!
  1. Load more activity
  • Create New...