Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Magno last won the day on June 14

Magno had the most liked content!

Community Reputation

4 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. YES!!!!! I missed this understanding!! Thank you so much!! 😄
  2. I have such class: type TmyNetHTTPClient = class(TNetHTTPClient) private FileName: String; Index: Integer; Downloaded: Boolean; FileStream: TFileStream; public procedure ReceiveData(const Sender: TObject; AContentLength, AReadCount: Int64; var Abort: Boolean); procedure RequestCompleted(const Sender: TObject; const AResponse: IHTTPResponse); end; Now I create my object and have some similar: // consider filestream already created and other needs for the sake of this example begin myNetHTTPClient := TmyNetHTTPClient.Create(self); myNetHTTPClient.Get('http://localhost/file.txt', FileStream); //myNetHTTPClient.onReceiveData; // error, so commented end; Now, what is I am doing wrong here? The ReceiveData(), and also RequestCompleted() are never triggered 😕 procedure TDownloader.ReceiveData(const Sender: TObject; AContentLength, AReadCount: Int64; var Abort: Boolean); begin doSomething(); end; What should I do to make it work?
  3. Magno

    How to make an "About" for a simple component?

    Thank you guys for all these information! Very useful and one who need can dig on this to make it work for he needs. Remy I will check the Indy approach. My awesome component needs no more than a label informing the version or a ShowMessage() kind of dialog. Thanks again!
  4. Magno

    How to make an "About" for a simple component?

    Thank you!! This is the path I needed.
  5. Magno

    How to make an "About" for a simple component?

    I want that one of the Published properties show an About, with that I can show the user the component version once it get installed in the Delphi IDE. uses uAbout; type TMyComponent = class(TComponent) private { Private declarations } fsAbout: TAbout; FUser: String; protected { Protected declarations } public { Public declarations } published { Published declarations } property About: TAbout Read fsAbout Write fsAbout Stored False; property User: String read FUser write FUser; end; I am stuck here. The TAbout is an external unit, like I show in the OP. So, when installed the User property shows on the IDE and the About, but I don't even know what technique to make it show a dialog or become a read only text. Thanks for the reply!
  6. I never had the real need for this but now I faced I really dunno how, making components are not my real business so here is my doubt, if one would like to help. Well, I have an unit (about.pas) that my compo will use, but this is everything I could do. I have no clue how do go forward. TAbout = Class(TComponent) Private fsAbout: TAbout; Public Procedure AboutDialog; //really? I dunno Published Property About: TAbout Read fsAbout Write fsAbout Stored False; End; procedure TAbout.AboutDialog; begin ShowMessage('Made by me =)'); end; ----- Now, my component has such: private { Private declarations } fsAbout: TAbout; ... published { Published declarations } property About: TAbout Read fsAbout Write fsAbout Stored False; end; And from here I don't know what to do. I would be happy with a read only label on my component too. Thank you for any help! 😃
  7. Yes, I understand that. Well, using const did not solved. Well, as I said, with Windows it works correctly. With Android once I draw it will replicate the value to any other gauge there. I think it somehow related to the painting method, I really dunno yet.
  8. There was no change on FMX. Maybe if I move to object component I could have more success but for this project I dunno...
  9. I will try move it, thanks but as they are different frames so one should not touch the other...
  10. Yes it is, thank you. I thinking to release it all source code later. The idea behind is simple and it is a quarantine project: I was thinking to monitor some of my computer sensors using WMI queries, but quickly I realise the information about GPU is device dependent on drivers and the time I would expend to accomplish won't be wort. I found a software called Open Hardware Monitor (https://github.com/openhardwaremonitor/openhardwaremonitor) that you can keep it running in background and expands the WMI. Now I have a server that read temps and loads so I can choose what I want to monitor. My computer case has a glass so I could put an old tablet or phone there inside 😄 Here's more decent screenshot of both client and server (still a WIP).
  11. What I have: a frame with a semi-arc that represents a gauge for information like temperature. See the attached image. Each of these controls are into a frame which I create in runtime depending from what I receive from my server. The structure is: TFrame->TRectangle->TPaintBox. The issue: when I run with Windows the arcs are correctly drawn, I sent the Value so it draws fine the correct gauge. When I run with Android, using the example attached with 3 gauges, all the 3 gauges will get redraw with the same value, even I am pointing to only one. I am using a code I found a modified later, but most of it is close to the original, it will use anti-aliasing to draw the arc, the code is bellow: type TAAArcSettings = record AStart, AEnd, Opacity: single; AThickStart, AThinkEnd: integer; Color: TAlphaColor; end; procedure TframeGauge.DrawArcAA(AParams: TAAArcSettings); var path: TPathData; poly: TPolygon; begin path := TPathData.Create; path.AddArc(rect.CenterPoint, TPointF.Create(rw, rh), AParams.AStart, AParams.AEnd); path.AddArc(rect.CenterPoint(), TPointF.Create(rw - AParams.AThickStart, rh - AParams.AThinkEnd), AParams.AStart + AParams.AEnd, -AParams.AEnd); path.ClosePath(); path.FlattenToPolygon(poly); APaintBox.Canvas.Fill.DefaultColor := TAlphaColorRec.Blue; APaintBox.Canvas.Stroke.Kind := TBrushKind.Solid; APaintBox.Canvas.Fill.Color := AParams.Color; APaintBox.Canvas.FillPolygon(poly, AParams.Opacity); path.DisposeOf; end; I make some calculations to define the initial and final angle plus the percent for the value representation. To intent set a value the code below is used: ArcSetting.AEnd := AEndAngle; ArcSetting.AStart := START_ANGLE; Rectangle1.BeginUpdate; APaintBox.Canvas.BeginScene; APaintBox.Repaint; // this will trigger the PaintBoxPaint() method and there inside I can the DrawArcAAA() APaintBox.Canvas.EndScene; Rectangle1.EndUpdate; There is a procedure TframeGauge.setGaugeValue(Value: integer) which will make the code above. In the main form it detects the frame and will call this procedure, but as I say all of any gauges will be drawn with the new value. This won't happen with Windows (both 32 and 64 bit). Maybe FMX for Android it is required something else beyond I know 😞 Thanks for reading and any clue where I could search for?
  12. Yep, but I think the helper with setting nil before is not so handy, but it is ok. This is the way, as I have spoken.
  13. The code bellow uses FireDac to create a new query object. The if not Assigned() sometimes will bring garbage and make the routine fail because as it reads something, so the "query" won't be created and crashes. procedure createMyQuery(var query: TFDQuery; Sql: String=''); begin if not Assigned(query) then // fail query := TFDQuery.Create(nil); query.Connection := myDatabase; query.SQL.Text := Sql; end; var myQuery: TFDQuery; begin createMyQuery(myQuery,'select * from table'); ... end; Anything I could make it ? The Delphi version is 10.2 update 3.
  14. I tried a simple new project, drop the required, following this example: http://docwiki.embarcadero.com/RADStudio/Rio/en/Tutorial:_Using_a_REST_DataSnap_Server_with_an_Application_and_FireDAC (same above) So I get an error (as the title of this thread suggests) when running the following method: function TServerMethods1.GetDepartmentNames: TFDJSONDataSets; begin // Clear active so that query will reexecute. FDQueryDepartmentNames.Active := False; Result := TFDJSONDataSets.Create; // The "TFDJSONDataSetsWriter" class provides static "ListAdd" method. // It uses reflection to convert results of the query into "TFDJSONDataSets". TFDJSONDataSetsWriter.ListAdd(Result, FDQueryDepartmentNames); end; The unique difference is that the FDQueryDepartmentNames has another name and points to a similar very simple table with a "select * from users".