Jump to content

Incus J

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Can anyone recommend a 3rd party JPEG library that works with Firemonkey? It would need to be fairly self-contained I think, so it would work on both Windows and MacOS.
  2. Thank you everyone for the encouragement and advice. I've made an initial attempt using the TThread class as a starting point - with some success, in that the Cancel button now works. To verify the main thread remains responsive I placed a spinning TAniIndicator on the form. It does spin during the lengthy image processing, however it pauses intermittently a couple of times during the processing of each image, which suggests something is still blocking the main thread? Question: Apart from updating the UI, is there anything else that typically requires a Synchronize? For example my thread contains file operations - should they be Synchronized too? I'm also encountering possible intermittent failure of CreateBitmapFromFile - which works perfectly when I run all my code on the main thread. So I'm making progress, but would welcome further pointers.
  3. Thank you for all the responses. It makes sense that FMX might have its own queue for UI controls. So Application.ProcessMessages may not be viable, and there may be a much better way to solve this, somehow. If I get a little more specific, would that help point to an alternative approach? Here's what I have so far: 1. User clicks "Go" 2. UI is disabled 3. Lots of photos are processed (lengthy operation) 4. UI is enabled again Apart from a Cancel button, the UI is intentionally disabled to user input during the lengthy operation. However several UI controls are regularly updated to indicate progress (a progress bar, image list, image view). This is all working OK right now. Since the UI is disabled, re-entrancy isn't an issue. The only thing lacking is a way to let the user cancel the lengthy operation part way through if they wish. I'd like to keep it simple. Is there a simple robust way to achieve a Cancel button? Threads: This scares me. Everything I've read on Delphi tasks and threads in forum post suggests they can lead to really hard to find program failures, and the library perhaps not yet robust. I've developed commercial software in Delphi for 20 years, but I don't feel ready for threads (or maybe the threading library isn't ready for me?). At the moment my software is working. Is there a safe, reliable approach to creating a Cancel button that doesn't give me the option to shoot myself, or my users, in the foot?
  4. In Delphi VCL I can use application.processmessages to process any queued messages, including pending events such as mouse clicks. Firemonkey also has application.processmessages - but its behaviour seems different, in that it doesn't process queued mouse clicks on buttons. This means that I am unable to check to see whether a Cancel button has been clicked part way through an operation. Is this correct? (Delphi FMX Tokyo 10.2.3)
  5. I'm having difficulty saving a JPEG file in Firemonkey. Here's the code: procedure SaveImage(bmp:TBitmap; filename:string); var vOpt:TBitmapCodecSaveParams; begin vOpt.Quality:=20; //Quality setting ignored? :( bmp.SaveToFile(filename,@vOpt); end; On Windows everything seems OK, however when the program is compiled for MacOS the resulting JPEG file is not at the Quality specified. The image quality setting seems to be ignored. How do I set the JPEG output quality on MacOS? (Delphi Tokyo 10.2.3)