Jump to content

Anders Melander

Members
  • Content Count

    2946
  • Joined

  • Last visited

  • Days Won

    166

Everything posted by Anders Melander

  1. Anders Melander

    ANN: Better Translation Manager released

    Even if your target project is 64-bit you don't need the resource builder to be 64-bit. The 32-bit build works with both 32- and 64-bit targets. Yes, you're right. It should be a THandle or a NativeUInt. I have pushed the fix. Thanks.
  2. Anders Melander

    Developer Express gave up on FMX

    From the comment track on that page: Oh, those Russians I think you're right. https://www.linkedin.com/company/developer-express-inc./people/
  3. Anders Melander

    ANN: Better Translation Manager released

    Yes - and it works for me. Does it fail on every target project you run it against? Why do you want it as a 64-bit executable? I don't think there should be any need for it as the memory usage is quite modest when building resource modules.
  4. Anders Melander

    ImageLists. One or Multiple??

    It almost was, but they dropped that ball long time ago: http://melander.dk/reseditor/ The resource editor was meant to be a part of Delphi 2010 but even though I implemented all Embarcadero's requirements (primarily two-way RC file support) the required open tools API was never surfaced in Delphi (basically just the ability to register a custom module editor). And when they stopped communicating I simply gave up on that project. I almost deleted the source in anger.
  5. Anders Melander

    Developer Express gave up on FMX

    There's some interesting information in that thread. From what I could understand through Google translate: DevExpress is American owned. Their developers are primarily Russian. Their supporters are Russian & Ukrainian. Is that correct? BTW, I just found this one: https://supportcenter.devexpress.com/ticket/details/t1081876/regular-updates-and-new-features
  6. Anders Melander

    Developer Express gave up on FMX

    I don't know but it could be some of their support people are busy killing each other. I'm heavily invested in their products but I must say that I've had mixed experiences with them these last few years. Their attitude towards enhancements gets a bit tiresome. Too often I see a reasonable request answered with "We don't plan to further enhance X in the foreseeable future", "We're just wrapping a standard Windows control" or "That's not how Microsoft does it". It seems many of their products are, if not in actual maintenance mode, then not really evolving anymore. I'm sure it doesn't help that Julian Bucknall seems to have fallen out of love with Delphi.
  7. Anders Melander

    DUnitX and StackTraces

    I just looked in my own unit tests and I can see that I have added the following to enable madExcept support. I can't remember why - or even if it works. ...unrelated stuff snipped... // Work around for broken Delphi 10.3 compiler support in bundled DUnitX {$if defined(MADEXCEPT)} type TMadExcept4StackTraceProvider = class(TInterfacedObject, IStacktraceProvider) public function GetStackTrace(const ex: Exception; const exAddressAddress: Pointer): string; function PointerToLocationInfo(const Addrs: Pointer): string; function PointerToAddressInfo(Addrs: Pointer): string; end; function TMadExcept4StackTraceProvider.GetStackTrace(const ex: Exception; const exAddressAddress: Pointer): string; begin Result := madStackTrace.StackTrace(false, false, false, nil, nil, exAddressAddress, false, false, 0, 0, nil, @exAddressAddress); end; function TMadExcept4StackTraceProvider.PointerToAddressInfo(Addrs: Pointer): string; begin Result := String(StackAddrToStr(Addrs)); end; function TMadExcept4StackTraceProvider.PointerToLocationInfo(const Addrs: Pointer): string; begin Result := String(StackAddrToStr(Addrs)); end; {$ifend} begin {$if defined(MADEXCEPT)} TDUnitXIoC.DefaultContainer.RegisterType<IStacktraceProvider, TMadExcept4StackTraceProvider>(true); {$ifend} {$if defined(RUNNER_TESTINSIGHT)} ExecuteTestInsight; {$elseif defined(RUNNER_GUI)} ExecuteGUIRunner; {$else} ExecuteConsoleRunner; {$ifend} end.
  8. Anders Melander

    looking for remote Delphi job

    It would probably improve your chances of getting a response if you stated where in the world you're located and didn't post under an alias.
  9. You're right. I need to flush my long term memory of obsolete information 🙂. In Delphi 5 the tread was started immediately in the TThread constructor. Since Delphi 6 it is started in AfterConstruction.
  10. Create the thread suspended and then start it once the constructor returns. It is generally a bad idea to construct a thread with CreateSuspended=False. I.e. instead of: constructor TEventChannel.TEvtLoadThread.Create(parent: TEventChannel); begin fParent := parent; inherited Create(False); end; do this: constructor TEventChannel.TEvtLoadThread.Create(parent: TEventChannel); begin inherited Create(True); fParent := parent; end; ... TheThread := TEvtLoadThread.Create(Something); TheThread.Start; ...
  11. Anders Melander

    Parnassus Bookmarks for Delphi 11 Alexandria?

    I've heard that it's a special integration operation and that everything is going according to plan. Nothing to see here. Move along.
  12. Anders Melander

    Set focus on dialog box button

    Replace this: if fChooseResult.showModal=mrOK then did:=dm.qStockNum.fieldbyname('design_id').asstring; with: if fChooseResult.Execute then did := dm.qStockNum.FieldByName('design_id').AsString; and then modify the TfChooseResult form like this: const MSG_AFTERSHOW = WM_USER; type TfChooseResult = class(TForm) ... protected procedure MsgAfterShow(var Msg: TMessage); message MSG_AFTERSHOW; public function Execute: boolean; end; implementation {$R *.dfm} procedure TfChooseResult.MsgAfterShow(var Msg: TMessage); begin BitBtn1.SetFocus; end; function TfChooseResult.Execute: boolean; begin PostMessage(Handle, MSG_AFTERSHOW, 0, 0); Result := (ShowModal = mrOK); end; Edit: Maybe I should explain what's going on. The PostMessage puts a custom message into the form's message queue. When ShowModal is called the form is displayed and the modal loop pumps the message queue [*]. The message pump grabs the custom message from the queue and calls the form's message handler (the MsgAfterShow method). MsgAfterShow focuses the button. [*] Pumping the message queue means that the code loops, reading one message at a time from the message queue and dispatching these messages to the "message handlers". It's "a bit" more complicated than that but hopefully you get the overall picture.
  13. Anders Melander

    Set focus on dialog box button

    Yes You can use Search->Find in files (Ctrl+Shift+F) to locate the place. Search for " fChooseResult .Show". No problem. Happy to help.
  14. Anders Melander

    Set focus on dialog box button

    @Pat Foley That example was really confusing - and contains so many bad practices.
  15. Anders Melander

    Set focus on dialog box button

    By the way, do yourself a favor and stop using TBitBtn. They were cute in the nineties. Not anymore.
  16. Anders Melander

    Set focus on dialog box button

    Nope. He's not calling the event handler. He's calling the Click method on the button - which emulates a click on the button.
  17. Anders Melander

    Set focus on dialog box button

    Assuming that you're showing this form modally from somewhere else I would do it like this: type TfChooseResult = class(TForm) wwDBGrid1: TwwDBGrid; Panel1: TPanel; dsResult: TDataSource; BitBtn1: TBitBtn; BitBtn2: TBitBtn; procedure wwDBGrid1DblClick(Sender: TObject); private public function Execute: boolean; end; var fChooseResult: TfChooseResult; implementation {$R *.dfm} procedure TfChooseResult.wwDBGrid1DblClick(Sender: TObject); begin BitBtn1.click; end; function TfChooseResult.Execute: boolean; begin BitBtn1.SetFocus; Result := (ShowModal = mrOK); end; and then display the form like this: begin ...do other stuff here... if (fChooseResult.Execute) then begin // User pressed OK end else begin // User closed dialog some other way end; end; And like Peter suggested, set the ModalResult property of the OK button to mrOK and the Default property of the same to True. If you add a Cancel button, set its ModalResult property to mrCancel and the Cancel property to True. If you're not displaying the form modally, then you'll need to call SetFocus in the forms OnShow event handler instead. This of course assumes that the form isn't visible all the time.
  18. Anders Melander

    Set focus on dialog box button

    Set it in code: ButtonOK.SetFocus; The ActiveControl property is a property of the form but that is only applied when the form is first created and it sounds like you are only doing that once.
  19. Anders Melander

    FireDAC, New OLE DB Driver, and SQL Server

    Um... you aren't using ODBC data sources via FireDAC, are you? ODBC is just the API FireDAC uses to talk to the driver. From your perspective there's nothing ODBC about it - the API could be anything. Maybe they did 🙂 We've just completed replacing MSSQL via ADO with FireDAC and for us it works fine. We had to update the client library to a newer version on a couple of clients but apart from that it's faster, better. I think the oldest SQL server version we connect to is 2014/v12.
  20. Anders Melander

    palette for 8 bit greyscale bitmap

    What you're dealing with is an unavavoidable rounding problem and a misunderstanding of what's going on mathematically. The two versions are equally bad. They just distribute the rounding error differently. You want the first palette entry to have a grey-level value of 0 and the last one to have a value of 255 - not 256. Level = 255 * (Index / (Levels-1)) or Grey := i * 255 div (_NumColors-1)
  21. Anders Melander

    Google WebP Image Format

    https://letmegooglethat.com/?q=delphi+webp Seems Bing has hijacked that service so here's a link without the sarcasm: https://www.google.com/search?q=delphi+webp
  22. Anders Melander

    Parallel Resampling of (VCL-) Bitmaps

    I had to reread the source 3 times before I spotted the place it occurs. "with" strikes again: ClusterWeight := ClusterX[X].Weight; with HorzBuffer[ClusterX[X].Pos - MapXLoPos] do begin Inc(Cb, B * ClusterWeight); // Note: Fixed precision multiplication done here Inc(Cg, G * ClusterWeight); Inc(Cr, R * ClusterWeight); Inc(Ca, A * ClusterWeight); end; As you can see I have now added a comment to make it obvious 🙂 Anyway, your changes has now been committed. Please verify that the comments I've added in the source are correct. I will continue working on correcting the alpha handling (i.e. do premultiplication).
  23. Anders Melander

    Parallel Resampling of (VCL-) Bitmaps

    Yes, you're right. I understand the midpoint rule but I just can't make your code fit it. Let me have a look again... Ah, now I get it. It was your comments that confused me. For example: // old weight: Filter(x0*Oldscale)*Oldscale If I just read the code and ignore the comments it makes much more sense. That's a new one 🙂 I mean that when you operate on 32-bit integer values which has been multiplied by $800 (= 1 shl 11) it means that the upper 21 bits will contain the integer part and the lower 11 bits the fractional part. In other words [21:11] fixed precision. When applying the weight values you do a shr 22 (= $800*$800) to convert from [10:22] fixed precision back to integer. The [10:22] must mean that you have multiplied two [21:11] values at some point but I can't really spot where that happens. FWIW much of Graphics32 supports the TFixed [16:16] fixed precision type. For example many methods allow you to specify coordinates in either integer, TFixed or floating point format. I don't understand what this refers to.
×