Jump to content

IElite

Members
  • Content Count

    1,191
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by IElite

  1. IElite

    TW3StringGrid is available

    @sibar You can use the built-in theme background from SmartCL.Theme.pas example: W3StringGrid1.RowBackgroundType:= bsDisplayBackground; W3StringGrid1.RowOddBackgroundType:= bsDisplayBackground; here are you choices/options TW3ThemeBackground = ( bsNone = 0, bsDisplayBackground, bsControlBackground, bsContainerBackground, bsListBackground, bsListItemBackground, bsDecorativeListItemBackground, bsListItemSelectedBackground, bsEditBackground, bsButtonBackground, bsDialogButtonBackground, bsDecorativeBackground, bsDecorativeInvertBackground, bsDecorativeDarkBackground, bsToolContainerBackground, bsToolButtonBackground, bsToolControlBackground, bsTransparentBackground ); you can do the same with the columns procedure TForm1.InitializeObject; var C: TW3StringGridColumn; begin inherited; {$I 'Form1:impl'} fSG:= TW3StringGrid.Create(self); C:= fSG.AddColumn; C.Caption:= 'One'; C.Width:= 100; c.BackgroundType := bsDecorativeDarkBackground; end;
  2. I can lean either way. I am not against keeping "W3" nor would I be against getting rid of it.
  3. IElite

    RoadMap 2019

    @jarto Myself, I am more interested in examples of client/server related projects (e.g. writing SMS clients for mobile devices which talk to node.js server).
  4. IElite

    RTL Search

    I use a free version of FileSeek
  5. IElite

    css styling

    Thanks, that did explain it better. Thanks for taking the time. I am interested in examining it further for sure.
  6. IElite

    css styling

    Im confused as well...I see nothing related to a 'card'
  7. IElite

    RoadMap 2019

    I just want to see more documentation and examples geared towards mobile devices.....i mean, it is called Smart Mobile Studio
  8. IElite

    Font size and style in buttons

    Suggestion 2
  9. IElite

    LocalStorage

    where is the most appropriate place to do the load and save from local storage in a project. i.e. from what event do you load from local storage and save to local storage? The Form's onactivate and ondeactivate do not seem to work uses ... SmartCL.Storage; var JSONStr: String; LocalStorage: TW3LocalStorage; procedure TForm1.Form1Deactivate(Sender: TObject); begin LocalStorage.setKeyStr('Data', JSONStr); end; procedure TForm1.Form1Activate(Sender: TObject); begin LocalStorage:= TW3LocalStorage.Create; try LocalStorage.Open('DEMO1'); finally JSONStr:= LocalStorage.GetKeyStr('Data', ''); end; end; thanx
  10. IElite

    How to resize a modal dialog

    Try capturing the orientation change explicitly and then calling the modal forms resize event within it function window: variant; external 'window' property; procedure TModalForm.InitializeObject; begin inherited;  {$I 'ModlForm:impl'} window.addEventListener('devicemotion', @Resize, false);  end;  procedure TModalForm.Resize; begin inherited; // your resize code here end;
  11. IElite

    Wrapping javascript library or ASM blocks ?

    oh shoot, i dont know why, but it is working now...hmmmm Thanks for all your help @lynkfs
  12. I am trying to use the API of the following website The API uses JSON-RPC 2.0 protocol. The API documentation is here They also provide a javascript library If I utilize this library in my SMS project, I can make the calls and get it to work, utlizing ASM block asm var loginClient = new JSONRpcClient({ 'url': 'https://user-api.simplybook.me' + '/login', 'onerror': function (error) {}, }); var token = loginClient.getToken('ACME', '88e24ae6c5cb30d9205ffc05b490daef8ddd189fefc'); var client = new JSONRpcClient({ 'url': '//user-api.simplybook.me', 'headers': { 'X-Company-Login': 'ACME', 'X-Token': token }, 'onerror': function (error) { alert(error); } }); console.log(JSON.stringify(client)); end; However, I am wondering if it is possible to create a Smart Pascal wrapper for this unit, so that I can call these in pascal and not have to worry about jumping back and forth between ASM block and pascal blocks of code? If so, can some one provide me an example of one of these? Are these two the only thing needing wrapper for? var JSONRpcClientException = function (code, message) { this.code = code; this.message = message; } var JSONRpcClient = function (options) { this.setOptions(options); this.init(); } Thanks
  13. IElite

    Wrapping javascript library or ASM blocks ?

    Seems like what i posted in my last post, works as well...i.e., using my api unit The issue was with the first section of code and the token I guess I assumed you had to login first, and get the token, and then use the token to get the Client object ???? like this: var loginClient = new JSONRpcClient({ 'url': 'https://user-api.simplybook.me' + '/login', 'onerror': function (error) {}, }); var token = loginClient.getToken('ACME', '88e24ae6c5cb30d9205ffc05b.........d189fefc8d09eb64752d5433994d0'); is that not correct? It looks like you hardcoded the token ? i was assigning that token variable instead like @client = new JSONRpcClient({ 'url': '//user-api.simplybook.me', 'headers': { 'X-Company-Login': 'Acme', 'X-Token': token }, 'onerror': function (error) { alert(error); } });
  14. IElite

    Wrapping javascript library or ASM blocks ?

    hmm, ok i will give your code a try. I added theose to javascript files to my project and then added them to a unit called api unit api; interface {$R "jquery-3.3.1.js"} {$R "json-rpc-client.js"} and then included the api unit in my main form
  15. IElite

    Wrapping javascript library or ASM blocks ?

    Thanks, You can look at their API explorer page, which lets you walk through the steps live https://simplybook.me/api/developer-api/tab/explorer_api
  16. IElite

    Wrapping javascript library or ASM blocks ?

    I see to still be having trouble with that last line var EventList: variant := client.getEventList(-params-); in their example online, you do not have to pass params, they are optional var client = new JSONRpcClient({ 'url': '//user-api.simplybook.me', 'headers': { 'X-Company-Login': '{companyLogin}', 'X-Token': '{token}' }, 'onerror': function (error) { alert(error); } }); var events = client.getEventList(); I have this code outside my asm block writeln('ok'); var EventList: variant := client.getEventList(); writeln('ok'); the first OK is written, but the second is not The EventList should be filled with a large block of JSON e.g. { "1": { "id": "1", "name": "Часовая фотосесcия", "duration": "60", "buffertime_before": "0", "buffertime_after": "0", "hide_duration": "0", "description": "Если Вы хотите попробовать себя в роли модели, но не определились с образом. 10 отретушированных и готовых к печати фотографий + отснятый материал на диске", "picture": "03661dd2903a3b3707807e30676821ae.jpg", "is_public": "1", "is_active": "1", "position": "0", "file_id": "1", "seo_url": null, "is_recurring": "0", "picture_sub_path": "/image_files", "is_visible": "1", "picture_path": "/uploads/mib/image_files/preview/03661dd2903a3b3707807e30676821ae.jpg", "unit_map": { "1": null }, "classes_plugin_info": { "unit_group_binded_in_class": null, "unit_groups_binded_in_classes": [] } }, ...................................................................................... } }
  17. IElite

    Calendar Control

    I would like to see a calendar control (TW3Calendar) in the RTL. Possibly derive it from TW3Grid? It would be nice to make it like the Delphi version, but I dont think it has to be as elaborate. I think you could keep the Month, Year, and Navigation controls off from the calendar and just make the Month and Year properties and the navigation routines. I would like to see at least the Month view (BONUS: year, and day view as well) I have looked at a lot of javascript versions and most are too bloated for me to attempt to port over. Features I would like to see: - should show the one or more days of previous month if current months first day starts on anything other than the first day of the week - should show the one or more days of next month if current months last day falls on anything other than the last day of the week - should be able to navigate through the years, months - should be able to highlight the current day - clickable days BONUS: able to set and highlight a range of days. Click and Drag
  18. IElite

    Endpoints & Resources ?

    How do i create an endpoint/resource and call one of the HTTP server functions/verbs (with the endpoint/resource)? I do not see anything in the featured demos that show this. When using JS/Node.js and using Express, I would normally do var express = require('express') var app = express() app.get('/api/programs', function (req, res) { // }); app.delete('/api/programs/:id', function (req, res) { // }); So, when I create a new SMART NodeJS project, where do I do declare the endpoint/resource? unit Unit1; interface uses System.Types, System.Types.Convert, System.Objects, System.Device.Storage, System.Streams, System.Reader, System.Writer, System.JSON, System.IOUtils, SmartNJ.System, SmartNJ.Device.Storage, SmartNJ.Application, SmartNJ.Server.Http; type TNodeProgram = class(TObject) private FServer: TNJHTTPServer; protected procedure HandleServerStarted(Sender: TObject); procedure HandleRequest(Sender: TObject; const Request: TNJHttpRequest; const Response: TNJHttpResponse); public procedure Execute; constructor Create; virtual; destructor Destroy; override; end; implementation constructor TNodeProgram.Create; begin inherited Create; FServer := TNJHTTPServer.Create; FServer.Port := 1881; FServer.OnAfterServerStarted := HandleServerStarted; FServer.OnRequest := HandleRequest; end; destructor TNodeProgram.Destroy; begin FServer.free; inherited; end; procedure TNodeProgram.Execute; begin // Start the server FServer.Start(); end; procedure TNodeProgram.HandleServerStarted(Sender: TObject); begin writelnF('Server listening on port %d', [FServer.port]); end; procedure TNodeProgram.HandleRequest(Sender: TObject; const Request: TNJHttpRequest; const Response: TNJHttpResponse); begin // Just end the request by sending the headers back as a string response.&End(request.Headers.ToString()); end; end.
  19. IElite

    Endpoints & Resources ?

    OH OK, Thanks for your help!
  20. IElite

    Endpoints & Resources ?

    @lynkfs thanks, I see how you showed how to parse the Url and handle each case. thanks! not sure I am understanding how data works? I am getting "Content: undefined" in my browser. Can you tell me how the data variant is used?
  21. IElite

    Send an email ?

    Just curious what the options are for sending an email from an SMS app? I have some information gathered from a user and would like to email the data to a specific email account. Has anyone implemented sending an email in their app yet?
  22. IElite

    Send an email ?

    Oh ok, so if I upload the project to my server, then it should work?
  23. IElite

    Send an email ?

    Not sure I follow you. So the code is not for Browser?
  24. IElite

    Send an email ?

    Sorry, I guess that was the wrong terminology to use. I haven't yet actually tried to send an email. All i have done was to add the all the code you provided above, particularly the smart enabled code. When I run my app , without sending the email, I get that error. I can't delete the scope line because it will complain - as I stated above. Not sure I can also delete the clientId ? Do you think?
  25. IElite

    Send an email ?

    @lynkfs I am trying your "smart" example out above However, it is crashing on this part of the code. If I comment out this entire bit of code, then everything else compiles and runs fine. gapi.client.init(class apiKey = '*****yAlr4k8Qkb8MpbjSbGBIi5h9067lZ4b5Cs'; discoveryDocs = ["https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest"]; clientId = '*****3111041-b3sfpthnis4ofc94d4qg9eo93q9rd7co.apps.googleusercontent.com'; scope = 'https://www.googleapis.com/auth/gmail.send'; end); I am getting this error: Uncaught #<Object> [line #103] Yes, the astrisks are there to mask my keys , i am using my full key and clientId if I comment out the ClientId and Scope, it will also compile and run without errors gapi.client.init(class apiKey = '*****yAlr4k8Qkb8MpbjSbGBIi5h9067lZ4b5Cs'; discoveryDocs = ["https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest"]; //clientId = '*****3111041-b3sfpthnis4ofc94d4qg9eo93q9rd7co.apps.googleusercontent.com'; //scope = 'https://www.googleapis.com/auth/gmail.send'; end); However, if I uncomment just the clientId out of those two, then i get this message: client_id and scope must both be provided to initialize OAuth. [line #71] so, then i uncomment the scope and again, i get the uncaught object error message
×