Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/25/21 in Posts

  1. Dalija Prasnikar

    Parallel processing question

    Yes, you can use that approach, but it is not flexible because your processing function depends on the specific UI type. I wouldn't create task inside Execute method because processing functionality itself should be implemented as clean synchronous code - that gives you more flexibility to combine its functionality as needed. I would use something like: TMyClass = class public procedure Execute(OnCompleted: TProc); end; procedure TMyClass.Execute(OnCompleted: TProc); begin // process data //... if Assigned(OnCompleted) then OnCompleted; end; procedure TMyForm.ProcessItem(li: TListViewItem); begin TTask.Run( procedure begin TMyClass(li.Data).Execute( procedure begin TThread.Queue(nil, procedure begin UpdateItem(li); end); end); end); end; procedure TMyForm.UpdateItem(li: TListViewItem); begin li. ... end; procedure TMyForm.ProcessView; begin for var li in lview1.Items do begin ProcessItem(li); end; end;
  2. David Heffernan

    stringreplace character in all string

    Big lesson here is always to show a proper minimal but complete reproduction. It wasn't clear what the problem was from the first post which was descriptive. Code doesn't lie.
  3. David Heffernan

    stringreplace character in all string

    Should be #0 rather than '#0'. Your code is replacing the text '#0' which doesn't appear in the string.
  4. David Heffernan

    Reading a binary file hangup without error

    But it's not text, you can't treat it as text, and there's nothing to learn. What you should learn is how text is encoded. Why not do that?
  5. Alexander Sviridenkov

    HTML Library Sale

    20% discount on delphihtmlcomponents.com products. Please use coupon code NY2022 (valid until end of the year). This is the last chance to order HTML Library at the current price. Prices will be increased in January, but renewal price (including a 15% discount increased by 5% every year) will remain the same for customers with continued subscription. https://delphihtmlcomponents.com/order.html
  6. dummzeuch

    Tool to fix up uses clause unit namespaces?

    GExperts has this functionality, but only for the current unit. Feel free to use that code to build a batch tool (it's not quite so easy since you must take the project settings and search paths into account). I'll accept patches, of course. 😉
×