Jump to content

Incus J

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Incus J

    TStringGrid background - Bitmap Style Designer

    OK - I've figured it out. Just in case it helps anyone: 1 - In addition to the Grid object there is a separate Colors section which lists a Grid color. This sets the Grid background color, however it may be necessary to set it a few times. The new color doesn't always take for some reason, and the option to 'Pick' a color from the screen seems buggy. 2 - Saving the Style, then simply recompiling does not update the style in the application. A full Build of the application is required. I've not yet worked out how to determine which item(s) in the Bitmap Style Designer relate to a specific control, other than trial and error, though the style preview can be helpful.
  2. Using a VCL Style, I'm trying to customise the background colour of TStringgrid objects. The empty part of the grid that contains no cells. At present the background is rendering white - and I'd like it to render a different colour. The Bitmap Style Designer lists a Grid object, which contains a single Fixed (TSeBitmapObject) item, but nothing relating to painting the background of the grid control. How can I determine which item(s) in the Bitmap Style Designer relate to all aspects of drawing a TStringgrid control?
  3. 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.
  4. 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.
  5. 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?
  6. 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)
  7. 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)
×