Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. Czar

    Getting user's input from input box

    Edit box?
  3. Yesterday
  4. DelphiNoob

    Getting user's input from input box

    Alright. Well then is there an alternative to get an input from the user?
  5. jarto

    Bugs and Features 3.1.0.88

    Thank you. Now I can reproduce the problem. Gonna have a look.
  6. tristan

    Bugs and Features 3.1.0.88

    TabForms.zip
  7. COMFIED

    Favicon

    Thanks!
  8. lynkfs

    Favicon

    The standard generated index file in smart doesn't contain a link tag for a favicon (something like <link id="favicon" rel="icon" href="res/favicon.png" type="image/png" sizes="16x16"> However this can be added in code (or add it manually to the default.html file in the template directory, or add it to a Custom Template in the ide) In code : procedure TForm1.InitializeForm; begin inherited; // this is a good place to initialize components var link := w3_createHtmlElement('link'); link.id := 'favicon'; link.href := 'res/favicon.png'; link.rel := 'icon'; link.&type := 'image/png'; link.sizes := '16x16'; browserapi.document.getElementsByTagName('head')[0].appendChild(link); end; If you want to change the icon later on, you can do that too procedure TForm1.W3Button1Click(Sender: TObject); begin var favicon := browserapi.document.getElementById('favicon'); favicon.href := 'res/favicon2.png'; end;
  9. jarto

    Bugs and Features 3.1.0.88

    Thank you bvery much for reporting these. TabForms.zip does not contain the form sfm-files, so I can't test that bug right away. Can you manyally zip the folder so all files are included?
  10. jarto

    TW3StringGrid is available

    Thank you @tristan and @IElite Yeah, creating new culumn types is really as simple as generating the right html. Especially with images. With images you probably don't even have to override SetColumnEvents. It's mainly used with controls where the used can change the cell value, like Edit, Combo and Boolean.
  11. COMFIED

    Favicon

    Hi Is there a way to automatically add head links to a page favicon .ico in the root or res folder via code?
  12. Last week
  13. tristan

    Bugs and Features 3.1.0.88

    Hi, Thanks for all the effort in making Smart Mobile Studio a powerful tool for pascal web development. After having a license for over a year I am finally making some effort at building a real life application. I just want to provide some feedback; I did try a quick search in the forum to avoid duplication. I believe I am testing the latest development version; however I do find it difficult to know with any certainty. Versioning Release notes in SmartUpdate have incorrect date (I think). Can you make it easier to identify the version available? SmartUpdate fails with DEVELOPMENT not available unless re-run with /changechannel /showhidden parameters IDE Import existing form. I could not find an intuitive way to import a form created from another project. Copy form into new project folder, add external, not added to Form section Switch comment (CTRL + /) will not include the last line selected Controls TabControl AnimateTabs with Forms in tabs, will cause form contents to disappear (in particular memo and stringrids) (See TabForms demo with TMemo on form3) Turning off AnimateTabs will resolve the issue. TabForms.zip
  14. lynkfs

    Responsive Design

    If this shortcut approach (providing html code directly in smart code) works for you, then adding event handlers has to be done in html too. Just add an ID to the img element so you can find the image element in the dom, and add an eventlistener to it : <!-- Photo by Drew Farwell on Unsplash --> <img id="mypic01" src="https://images.unsplash.com/photo-1513309914637-65c20a5962e1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3450&q=80" alt="Several friends doing a toast"> <figcaption><h3>Drake Equation</h3></figcaption> etc... browserapi.document.getElementById("mypic01").addEventListener("click", procedure(event:variant) begin writeln('clicked'); end); Note that once you start mixing direct dom manipulation with standard rtl processing, you're mixing different worlds. Things might look the same but not necessarily have the same effect. The onclick event handler above is not the same as the standard smart OnClick handling etc. See what works for you.
  15. tristan

    TW3StringGrid is available

    For anyone needing something similar unit SmartCL.Controls.StringGrid.ImageColumn; interface uses W3C.DOM, System.Types, System.Types.Graphics, System.Types.Convert, System.Time, System.Dictionaries, SmartCL.Application, SmartCL.Components, SmartCL.System, SmartCL.Theme, SmartCL.Css.Classes, SmartCL.Scroll, SmartCL.Controls.Label, SmartCL.Controls.StringGrid, SmartCL.Controls.Image; type TW3StringGridImageColumn = class(TW3StringGridColumn) protected function GetClasses: String; override; public constructor Create; override; function GenerateHtml(GridLine: TW3RenderedGridLine; ColumnIndex, CurrentLeft: Integer): String; override; procedure SetColumnEvents(Sender: TW3CustomStringGrid; GridLine: TW3RenderedGridLine; ColumnIndex: Integer); override; end; implementation constructor TW3StringGridImageColumn.Create; begin FBaseClass := 'TW3Image'; AlignText := taCenter; VAlign := tvCenter; BorderType := btLightBorderRight; BackgroundType := bsNone; end; function TW3StringGridImageColumn.GenerateHtml(GridLine: TW3RenderedGridLine; ColumnIndex, CurrentLeft: Integer): String; begin var ItemId:=Grid.Handle.id+'_row_'+IntToStr(GridLine.DataIndex)+'_btncol_'+IntToStr(ColumnIndex); GridLine.ItemIds.Add(ItemId); result:='<img id="'+ItemId+'" class="'+GetClasses+'" style="visibility: visible; display: inline-block; overflow: hidden; left: '+IntToStr(CurrentLeft)+'px; position: absolute; width: '+IntToStr(Width)+'px; height: 100%;border-radius: 0px;" src="'+TString.EncodeTags(Grid.Cells[GridLine.DataIndex,ColumnIndex])+'"</img>'; end; function TW3StringGridImageColumn.GetClasses: String; begin result:=inherited GetClasses+' TW3ButtonBackground'; end; procedure TW3StringGridImageColumn.SetColumnEvents(Sender: TW3CustomStringGrid; GridLine: TW3RenderedGridLine; ColumnIndex: Integer); // Note: This is used by the combo box too var cHandle: THandle; begin try cHandle := GridLine.FixedCols.Handle.GetChildById(GridLine.ItemIds[ColumnIndex]); if not (cHandle) then cHandle := GridLine.ScrollableCols.Handle.GetChildById(GridLine.ItemIds[ColumnIndex]); // cHandle['oninput'] := @Sender.HandleDataChanged; except end; end; end.
  16. tristan

    TW3StringGrid is available

    @IElite Thanks for that very helpful reply.
  17. kockas

    Responsive Design

    Oh yes... this grid design very good looking on my phone also! Thank you so much! Somebody can write how is possible to catch a separated click event for examle just for the center image in this project? // I talked about this section in the innerHTML: <li> <figure> <!-- Photo by Drew Farwell on Unsplash --> <img src="https://images.unsplash.com/photo-1513309914637-65c20a5962e1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3450&q=80" alt="Several friends doing a toast"> <figcaption><h3>Drake Equation</h3></figcaption> </figure> <p> Another world citizens of distant epochs from which we spring descended from astronomers Orion''s sword shores of the cosmic ocean. </p> </li>
  18. IElite

    TW3StringGrid is available

    @tristan You will need to create your own / derive your own column from TW3StringGridColumn located in the unit SmartCL.Controls.StringGrid. Take a look at the SmartCL.Controls.StringGrid unit and see how for example, the button column (TW3StringGridButtonColumn) is created TW3StringGridButtonColumn = class(TW3StringGridColumn) protected function GetClasses: String; override; public constructor Create; override; function GenerateHtml(GridLine: TW3RenderedGridLine; ColumnIndex, CurrentLeft: Integer): String; override; procedure SetColumnEvents(Sender: TW3CustomStringGrid; GridLine: TW3RenderedGridLine; ColumnIndex: Integer); override; end; { TW3StringGridButtonColumn } constructor TW3StringGridButtonColumn.Create; begin FBaseClass := 'TW3Button'; AlignText := taLeft; VAlign := tvCenter; BorderType := btLightBorderRight; BackgroundType := bsNone; end; function TW3StringGridButtonColumn.GenerateHtml(GridLine: TW3RenderedGridLine; ColumnIndex, CurrentLeft: Integer): String; begin var ItemId:=Grid.Handle.id+'_row_'+IntToStr(GridLine.DataIndex)+'_btncol_'+IntToStr(ColumnIndex); GridLine.ItemIds.Add(ItemId); result:='<input id="'+ItemId+'" type="button" class="'+GetClasses+'" style="visibility: visible; display: inline-block; overflow: hidden; left: '+IntToStr(CurrentLeft)+'px; position: absolute; width: '+IntToStr(Width)+'px; height: 100%;border-radius: 0px;" value="'+TString.EncodeTags(Grid.Cells[GridLine.DataIndex,ColumnIndex])+'"</input>'; end; function TW3StringGridButtonColumn.GetClasses: String; begin result:=inherited GetClasses+' TW3ButtonBackground'; end; procedure TW3StringGridButtonColumn.SetColumnEvents(Sender: TW3CustomStringGrid; GridLine: TW3RenderedGridLine; ColumnIndex: Integer); // Note: This is used by the combo box too var cHandle: THandle; begin try cHandle := GridLine.FixedCols.Handle.GetChildById(GridLine.ItemIds[ColumnIndex]); if not (cHandle) then cHandle := GridLine.ScrollableCols.Handle.GetChildById(GridLine.ItemIds[ColumnIndex]); cHandle['oninput'] := @Sender.HandleDataChanged; except end; end;
  19. tristan

    TW3StringGrid is available

    Hi, Is it possible to add an image to a cell?
  20. DavidRM

    PixiJS v5

    How hard would it be to to get the PixiJS unit included with SMS updated to the latest release (v5)? Thanks! -David
  21. jarto

    Issue with DEVELOPMENT-branch (was BETA) building APP

    @Tim Koscielski Here's my best guess about what is going on: I assume you have added the Grid in the Designer. That means that the Grid control is created in Form.InitializeObject here: {$I 'Form_ProjectMasterListN:impl'} The compiler generates the code to create the grid and set its properties. After that you call InitGrid. Now, when a control is created in JavaScript, the browser initializes it asynchronously. This means that your code continues to run but it takes some time before the control is actually ready. It may be that on your computer it takes so long that the Grid's handle is not ready when you start accessing it. In the latest development update I changed the code that is created for that impl section. When earlier the control was just created and properties were set, now the generated code waits for the object to be ready. Only after that it starts setting properties. It eliminates random problems. To be sure that the Grid is ready, you can call InitGrid like this: TW3Dispatch.WaitFor([W3Grid1], procedure begin InitGrid; end); That's the same way the code generated by the IDE does it.
  22. IElite

    Issue with DEVELOPMENT-branch (was BETA) building APP

    I am using the latest and greatest - current development update 3.1.0.88 see attached project testproj.zip
  23. Tim Koscielski

    Issue with DEVELOPMENT-branch (was BETA) building APP

    Ok, I think I need to go back on all of that above, it was NOT A PROBLEM with the Grid. I think it was a problem with object initialization. In this project, I was using FontAwesome and I had the following for a form in the InitializeObject procedure. I initialized the Grid and added the InnerHTML to a button. procedure TForm_ProjectMasterListN.InitializeObject; begin inherited; {$I 'Form_ProjectMasterListN:impl'} writeln('InitializeObject'); InitGrid; W3Button1.InnerHTML:=#'<i class="fa fa-refresh fa-2x"></i>'; end; As I worked through this I discovered the when I removed InitGrid and the InnerHTML items from InitializeObject, the error went away. I then added these to InitializeForm and it then worked correctly. I am assuming that with some of the new features in this BETA, this is something changed, but also I assume that I had been doing this the wrong way anyway. Now when I run my code in InitializeForm, it all works. If anyone has any additional insight, please let me know. Thank you for the help.
  24. Tim Koscielski

    Issue with DEVELOPMENT-branch (was BETA) building APP

    Thanks. I appreciate you trying it out. Still trying to track down exactly what is the issue with my project.
  25. IElite

    Issue with DEVELOPMENT-branch (was BETA) building APP

    so does this: procedure TForm1.InitGrid; var Col_ProjectId: TW3TextColumn; begin Col_ProjectId := TW3TextColumn.Create(W3Grid1 as IW3ColumnsControl); Col_ProjectId.Header.Caption := '#'; Col_ProjectId.Header.Alignment:= taCenter; Col_ProjectId.Alignment := taCenter; Col_ProjectId.Width:= 100; W3Grid1.Columns.Add(Col_ProjectId); end; procedure TForm1.InitializeObject; begin inherited; {$I 'Form1:impl'} InitGrid; end;
  26. IElite

    Issue with DEVELOPMENT-branch (was BETA) building APP

    This works for me just fine. Not sure where you are calling InitGrid from procedure TForm1.W3Button1Click(Sender: TObject); var Col_ProjectId: TW3TextColumn; begin Col_ProjectId := TW3TextColumn.Create(W3Grid1 as IW3ColumnsControl); Col_ProjectId.Header.Caption := '#'; Col_ProjectId.Header.Alignment:= taCenter; Col_ProjectId.Alignment := taCenter; Col_ProjectId.Width:= 100; W3Grid1.Columns.Add(Col_ProjectId); end;
  27. Earlier
  28. Tim Koscielski

    Issue with DEVELOPMENT-branch (was BETA) building APP

    OK, now I have some more info. The issue I'm having is specifically with TW3Grid. My code was initially based on the demo provided and does approximately the exact same process. The demo grid project still works exactly as it is, but now I am comparing the two and at the moment everything seems to be reasonably the same In ObjectInitialize in my project, I am creating the columns in the grid with the following code. The very first TW3TextColumn.Create I call is generating the error. I am digging into this later today and I'll continue to update what I find. If anyone has any ideas, please let me know. procedure TForm.InitGrid; var Col_ProjectId: TW3TextColumn; begin Col_ProjectId := nil; Col_ProjectId := TW3TextColumn.Create(W3Grid1 as IW3ColumnsControl); Col_ProjectId.Header.Caption := '#'; Col_ProjectId.Header.Alignment := taCenter; Col_ProjectId.Alignment := taCenter; Col_ProjectId.Width := 100; W3Grid1.Columns.Add(Col_ProjectId); end;
  1. Load more activity
×