Jump to content

Remy Lebeau

Members
  • Content Count

    2684
  • Joined

  • Last visited

  • Days Won

    113

Everything posted by Remy Lebeau

  1. Remy Lebeau

    Delete unicode non-breaking space

    That is because the original data is encoded in UTF-8, but once it is loaded into your string, it is no longer encoded in UTF-8, it is encoded in UTF-16 instead. $C2 $A0 are the UTF-8 bytes for the non-breaking character, whereas $00A0 (decimal 160) is the UTF-16 value of that same character.
  2. Remy Lebeau

    Delphi JSON data to listbox

    That is an numeric field. Simply Get() a TJSONValue pointer to it, then type-cast that pointer to TJSONNumber, and then read its AsInt property, eg: Arr := Obj.Get('meta_data') as TJSONArray; for Value in Arr do begin Obj := Value as TJSONObject; id := (Obj.Get('id') as TJSONNumber).AsInt; end; I suggest you read the documentation before going any further.
  3. Remy Lebeau

    Delphi JSON data to listbox

    You did not show the complete JSON, so the below example is incomplete, but it should give you an idea of what you need: uses ..., System.JSON; ... var Root, Value: TJSONValue; Obj: TJSONObject; Arr: TJSONArray; I: Integer; begin ListBox1.Items.Clear; Root := TJSONObject.ParseJSONValue(...); try Obj := ...; // get a pointer to the parent object first as needed, then... Arr := Obj.GetValue('line_items') as TJSONArray; for Value in Arr do begin Obj := Value as TJSONObject; ListBox1.Items.Add(Obj.Get('name').Value); end; finally Root.Free; end; end;
  4. Remy Lebeau

    Custom component Resource PRINTFORM not found

    Who's "He" exactly? The IDE? Your code? Where exactly are you seeing the error?
  5. Remy Lebeau

    EULA declined installing 11.1 with Network Named license

    Same reasons all of my VMs were XP, until I was forced to start making Win7 VMs. Same
  6. Remy Lebeau

    Does anyone know how to get the filesystem for usb mass storage?

    Have you read the documentation yet? Using Java Libraries in Your RAD Studio Android Apps
  7. Remy Lebeau

    Loading data from dfm

    Uwe Raabe already nailed the root cause of your error - FCaptionsAdded is not instantiated early enough, so it is nil when the DFM system is trying to access it. The real question is, why are you MANUALLY streaming FCaptionsAdded AT ALL? TStringList is a TPersistent descendant that implements its own native DFM streaming logic. So, it is enough to just declare a TStrings/TStringList property in your component and back it with a VALID TStringList instance at component creation, no manual streaming is necessary.
  8. Remy Lebeau

    Tstringgrid grid index out of bounds

    Then it has to be a bug in the Grid, as it should be working given what you have described. I would suggest turning on "Use Debug DCUs" in the Project Options, and then step into the Grid's source code with the debugger to see exactly what is actually failing, and where it is occurring. On a separate note, have you tried the Grid's Selection property yet? var r: TGridRect; r.Left := setgridcol; r.Top := setgridrow; r.Right := setgridcol; r.Bottom := setgridrow; StringGrid1.Selection := r; But, given the screenshot and the values provided, it should not be out of bounds. That is the issue.
  9. Remy Lebeau

    Indy & OpenSSL 1.1.1 & TLS 1.3

    The IF is certainly a yes, but I couldn't tell you the WHEN for sure. But you can try out the pending code for yourself at https://github.com/IndySockets/Indy/pull/299 and see if it works for you.
  10. Remy Lebeau

    Indy & OpenSSL 1.1.1 & TLS 1.3

    I totally agree. And I have been meaning to reach out to the community for a long time looking for volunteers to join the dev team on a more regular basis, I just haven't gotten around to it. Well, it is still being actively maintained, as in it receives updates for fixes, and adding minor features that are easy to add to the existing code. But major updates have been delayed for a long time. Namely, releasing Indy 11 (maintenance release to drop pre-Unicode compilers, restructure the runtime packages, etc) and starting on Indy 12 (major new features, logic rewrites, etc) has been on the back-burner for many years now. Actually, Indy 11 is almost ready, but without an IDE I haven't been able to test the new structure and finalize it.
  11. Remy Lebeau

    Indy & OpenSSL 1.1.1 & TLS 1.3

    Status hasn't changed since the last time you asked. The new support code for OpenSSL 1.1.x and TLS 1.3 is still in Pull Request #299 on GitHub awaiting review and merge into the main codebase. AFAIK, it works in general, but I offer no guarantees about it yet as there are some open issues with it, cross platform support hasn't been tested, etc. It is not dead. I still work on it pretty frequently, but I'm pretty much the only developer working on it (aside from the occasional contribution from users or Embarcadero), and I just don't have the kind of free time that I used to have. But I do what I can with the time I can spare for it. Plus, it doesn't help that I don't have a working IDE installed anymore. Many years ago (I just checked my blog, and wow, I didn't realize just how many years have past now!), a series of multiple back-to-back system crashes took out my entire development environment - all of my VMs, NAS backups, laptop, everything gone. To this day, I still haven't recovered any of my old files yet. In the case of Indy specifically, fortunately the main code was stored online, so I can continue to checkin updates/fixes as needed, but I lost a lot of internal dev code I was working on at the time. As for the IDE itself, I just haven't committed time to reinstall it yet. I don't use RAD Studio in my day job anymore. Not to mention I haven't been very happy with all the problems I see people report in various online forums about the past handful of releases, so I've been hesitant to reinstall a new IDE for awhile. But, last year I did finally buy a new laptop for future dev work, and plan on installing RAD Studio onto it (eventually). I know, it sounds like I'm just making excuses. Maybe I am. I need to pick up the slack ...
  12. Remy Lebeau

    access violation vcl260.pbl

    The app doesn't use Delphi, it is written in Delphi. In any case, as an end user of the app, not its developer, you are not going to be able to diagnose that error. You need to contact the developer to troubleshoot. Offhand, I would guess that a nil pointer is being accessed. That is likely to be a bug in the app. Only the developer will be able to find out for sure. No. The app would be responsible for creating its own logs.
  13. Remy Lebeau

    .NET kill the Delphi IDE

    Try removing/disabling the refactoride*.bpl package in the IDE's "Known IDE Packages" Registry key.
  14. Remy Lebeau

    How to play sound via stream in android platform

    Internally, that is downloading an audio file from a URL, and then playing it. That is not the same as playing audio samples from memory or a resource. AFAIK, FireMonkey simply does not implement that kind of functionality natively, so you will have to implement it manually. See this StackOverflow post if you want to implement custom handling of other audio sources.
  15. Remy Lebeau

    .NET kill the Delphi IDE

    The current IDE architecture was originally introduced in Delphi 8 to support development of Delphi.NET applications. So there was a lot of .NET-oriented features in the IDE itself. But nowadays, with Delphi.NET being long gone, pretty much the only thing left in the IDE that still uses .NET is the refactoring tools that parse and manipulate code. Replacing that functionality to remove .NET is a huge effort, which is why it hasn't been done yet.
  16. Remy Lebeau

    Incompatible types bug in D11.1

    The error message is correct, but the IDE is flagging the wrong line of code. It flagged line 58, but the error is actually on line 63: shpLinhaTopo := shpLinhaTopo.Left + 1; You are assigning an Integer to a TShape, not a property of the TShape. That line should be this instead: shpLinhaTopo.Left := shpLinhaTopo.Left + 1; That being said, your movement code is wrong in general, because it is accessing UI controls from the context of a worker thread without synchronizing with the main UI thread. The VCL is not thread-safe, you must synchronize, eg: procedure TfrmViewMain.MoveShapeItem(Value: TPanel); begin TThread.CreateAnonymousThead( procedure begin TThread.Synchronize(nil, procedure begin while shpLinhaTopo.Left <> Value.Left do begin if shpLinhaTopo.Left > Value.Left then shpLinhaTopo.Left := shpLinhaTopo.Left - 1 else shpLinhaTopo.Left := shpLinhaTopo.Left + 1; end; end ); end ).Start; end; Which defeats the whole purpose of using a worker thread. So, in this case, you can use TThread.ForceQueue() instead, eg: procedure TfrmViewMain.MoveShapeItem(Value: TPanel); begin TThread.ForceQueue(nil, procedure begin while shpLinhaTopo.Left <> Value.Left do begin if shpLinhaTopo.Left > Value.Left then shpLinhaTopo.Left := shpLinhaTopo.Left - 1 else shpLinhaTopo.Left := shpLinhaTopo.Left + 1; end; end ); end; Though, in either case, your while loop won't exit until the TShape meets the TPanel, and you are not likely to see each movement being redrawn onscreen, so you may as well just get rid of the loop altogether: procedure TfrmViewMain.MoveShapeItem(Value: TPanel); begin TThread.ForceQueue(nil, procedure begin shpLinhaTopo.Left := Value.Left; end ); end; If you want to visually see the TShape move around, you need a delay between each move, eg: procedure TfrmViewMain.MoveShapeItem(Value: TPanel; AStepDelay: Integer = 100); begin TThread.ForceQueue(nil, procedure if shpLinhaTopo.Left <> Value.Left then begin if shpLinhaTopo.Left > Value.Left then shpLinhaTopo.Left := shpLinhaTopo.Left - 1 else shpLinhaTopo.Left := shpLinhaTopo.Left + 1; MoveShapeItem(Value, AStepDelay); end; end, AStepDelay ); end;
  17. That new snippet has nothing to do with your proposed VirtualTree property. So now I am completely lost as to what you really want. I'm out. Good luck.
  18. Correct, because a component event can have only 1 handler assigned at a time. If you need multiple handlers, you need to chain them together, ie have one handler call the other. After re-reading your original post, it is not clear to me what exactly you really want, so please clarify, preferably with an actual workflow example.
  19. Is this what you are looking for? type TMyComponent = class(...) private FVirtualTree: TBaseVirtualTree; procedure SetVirtualTree(AValue: TBaseVirtualTree); procedure VirtualTreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode); protected procedure Notification(AComponent: TComponent; Operation: TOperation); override; public destructor Destroy; override; published property VirtualTree: TBaseVirtualTree read FVirtualTree write SetVirtualTree; end; destructor TMyComponent.Destroy; begin SetVirtualTree(nil); inherited; end; procedure TMyComponent.Notification(AComponent: TComponent; Operation: TOperation); begin inherited; if (Operation = opRemove) and (AComponent = FVirtualTree) then FVirtualTree := nil; end; procedure TMyComponent.SetVirtualTree(AValue: TBaseVirtualTree); begin if AValue <> FVirtualTree then begin if FVirtualTree <> nil then begin FVirtualTree.OnChange := nil; FVirtualTree.RemoveFreeNotification(Self); end; FVirtualTree := AValue; if FVirtualTree <> nil then begin FVirtualTree.FreeNotification(Self); FVirtualTree.OnChange := VirtualTreeChange; end; end; end; procedure TMyComponent.VirtualTreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode); begin // do something... end;
  20. Remy Lebeau

    TNetEncoding.URL.Decode question

    IntraWeb is built on top of Indy, and Indy has its own URL encoder/decoder (the TIdURI class).
  21. This is better handled using a waitable mutex or other synchronization object. The thread can wait on the object when it has nothing else to do, and another thread can signal the object to wake up the waiting thread.
  22. Remy Lebeau

    INI problem

    It is really not a good idea to store your data files in your program's installation folder, especially if it is installed under ProgramFiles. Windows has dedicated folders set aside for storing data files, you should create your own subfolder underneath them, such as %APPDATA%\MyApp, etc.
  23. Remy Lebeau

    LSP con C++ Builder 11.1

    Of course they do. New versions go through months of beta testing before release. Sometimes they do, sometimes they don't. It comes down to how they use the product, like anyone else.
  24. Indy supports thread-pooling in its TCP servers. I don't use IntraWeb, so I don't know if/how that can be enabled in the context of IntraWeb, though. But the code logic that is accessing a window handle across thread boundaries, without regard to the owning thread destroying the window at any time, needs to be fixed. That is certainly not an Indy/IntraWeb issue.
  25. Remy Lebeau

    Attachments to iPhones

    But, can you send a PDF from Outlook to iPhone and open it OK? If not, then this is an iPhone issue, otherwise this is an Indy issue. Just a few comments: You are (potentially) leaking the Indy objects (other than the MessageBuilder). You did not say which version of Delphi you are using, but I'm assuming it is an older version where FMX still relied on ARC memory management for objects on mobile platforms. That ARC system was removed in Delphi 10.4, so if you are (or ever will be) using 10.4 or later, you need to Free() unowned objects manually to avoid leaks. You are setting the TIdMessage.ContentType property 3 times, which is (obviously) redundant. Let the TIdMessageBuilderHtml populate the TIdMessage with the bulk of its settings as needed (including the ContentType), then you can provide the rest (Sender, Recipients, Subject, etc). The TIdMessageBuilderHtml.HtmlFiles property is meant for attachments that are referenced by the HTML (images, etc). So, unless you are displaying the PDF embedded in the HTML, non-HTML attachments that the user can download and save should be in the TIdMessageBuilderHtml.Attachments property instead. You don't need to set the SSLIOHandler's Destination, Host, or Port properties manually, Connnect() will handle that for you. I would suggest using the SSLIOHandler's SSLVersions property instead of its Method property. Not all servers require TLS 1.2 yet, so you should also enable TLS 1.1 at least. Connect() should be outside of the try/finally that calls Disconnect() Try this: procedure CreateIndyEmail( const xMsg: string; const xFirstName: string; xNameid: integer; const xEmail: string; const xSubject: string ); var DATA: TIdMessage; SMTP: TIdSMTP; SSL: TIdSSLIOHandlerSocketOpenSSL; begin DATA := TIdMessage.Create(nil); try with TIdMessageBuilderHtml.Create do try Html.Text := xMsg; //if gvbAttached then HtmlFiles.Add( gvAttachedFile ); if gvbAttached then Attachments.Add( gvAttachedFile ); FillMessage( DATA ); finally Free; end; DATA.Subject := xSubject; DATA.From.Address := 'Seniors@xyz.com'; DATA.Sender.Address := 'Seniors@xyz.com'; DATA.ReplyTo.EMailAddresses:= 'Seniors@xyz.com'; DATA.Recipients.EMailAddresses := xEmail; SMTP := TIdSMTP.Create(nil); try with SMTP do begin UseTLS := utUseExplicitTLS; Host := 'smtp.livemail.co.uk'; Port := 587; AuthType := satDefault; Username := 'Seniors@xyz.com'; Password := 'xyz'; end; IdOpenSSLSetLibPath( cLoc ); SSL := TIdSSLIOHandlerSocketOpenSSL.Create(SMTP); with SSL do begin SSLOptions.Mode := sslmClient; SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; SSLOptions.VerifyMode := []; SSLOptions.VerifyDepth := 0; end; SMTP.IOHandler := SSL; SMTP.Connect; try SMTP.Send( DATA ); finally SMTP.Disconnect; end; finally SMTP.Free; end; finally DATA.Free; end; end;
×