Using Visual Components in Web Server lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2019-07-08 02:50 Hi, I can't use visual components like TTreeView, etc. in web server program. Actually defining "ComCtrls", etc. in uses clause makes error in the compilation process. Is there any way that I can use only non-visual functions of these controls? Followings is a typical example of my cases. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i tv1 := TTreeView.Create(nil);    //  Create a TTreeView within web server tvItem := tv1.items.add(nil, 'this is first node');   // Add some items in theretvItem := tv1.items.addChild (tvItem, 'this is first child to first node');  AMemStream := TMemoryStream.Create;    tv1.SaveToStream(AMemStream);    // Save treeview to memory stream tv1.Free;  AResponse.ContentStream := AMemStream;    // Response with the memory streamHandled := True;                     My Windows application will receive the stream, and load it to a target visual component. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MyVisualTreeView.LoadFromStream(AMemStream); Is there any way to do this, like using TCustomTreeView, etc.? ---------------------------------------------------------------------- Leledumbo · 2019-07-23 08:52 I'm not sure if streaming works across environment but let's assume it does. Add LCL to your project's dependency, now you should be able to compile your project but it will depend on libraries of the chosen widgetset. Then just run and try it ---------------------------------------------------------------------- Thaddy · 2019-07-23 09:31 That create(nil) is indeed impossible to make it work correctly. The proper approach is to create a GUI application that contains the webserver, not the other way around. Your approach is simply wrong. The GUI application can of course be hidden and running in the background. Use a hotkey to make it visible/hidden. Another approach is to write a service or daemon as the webserver and a controller as a GUI app that communicates with the service/daemon. Note: if you misuse the visual component as an ordinary tree (not visible), use an ordinary tree instead. (I have seen that happen!, wrong approach) Note2: if it is your intention to serve a treeview, use a javascript component instead. You can Pascalize that with pas2js.