Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FMX version #1

Open
birbilis opened this issue Apr 8, 2022 · 6 comments
Open

Add FMX version #1

birbilis opened this issue Apr 8, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@birbilis
Copy link

birbilis commented Apr 8, 2022

Could use some conditional defines I think to check if the project is FMX or VCL one and use the appropriate Style management unit. The more or less the rest of the code should be the same

@birbilis
Copy link
Author

birbilis commented Apr 8, 2022

Eventually one could contribute an implementation of IFMXSystemApperanceService for Windows, as mentioned at https://quality.embarcadero.com/browse/RSP-37290 and in comments at https://stackoverflow.com/a/67457500/903783

@checkdigits checkdigits self-assigned this Apr 8, 2022
@checkdigits
Copy link
Owner

Hmm. There is an intention to refactor this as a class helper for forms. This is how I've seen things like rounded corners done and so on and I've seen Marco Cantu using this method as well.

With it refactored as a class helper it would be a little more than conditional defines but still doable. 👍

I think I'll definitely add FMX support and likely combine in the rounded corners control too just for good measure.

@checkdigits checkdigits added the enhancement New feature or request label Apr 8, 2022
@birbilis
Copy link
Author

what I was meaning is that FMX has a service to get dark mode info (but not notification for it switching I think) for OS-X, iOS, Android but not for Windows. Such platform services are defined as interfaces and then concrete implementations per platform are provided. The client just asks FMX for an FMX service interface implementation for the current platform and it checks if one has been registered for the current platform/architecture and returns it. So the missing Windows bits could be taken from your implementation and have a full FMX implementation for all platforms (ok, apart from Linux), with the missing part though being registering for notifications (the FMX service definition lacks that I think as a concept)

@checkdigits
Copy link
Owner

Yes, but the FMX service as it stands would limit the minimum version of Delphi/C++ builder it would work with. That said it's not a bad idea to add in the missing Windows capabilities.

The trapping of the change event is relatively simple on Windows (until Microsoft change how it works!) but for other platforms it's not quite as universally supported which may be why it was avoided in the first place.

Thanks for the inspiration. I just need to invent a few extra weekdays now, so I get the time to do it all. 🤪

@birbilis
Copy link
Author

birbilis commented Jun 1, 2022

actually, I'd expect Embarcadero to port those interfaces back into VCL so that one could evolve their VCL app gradually with such features and eventually either port it or maintain both VCL and FMX versions of their app with a large common codebase

@checkdigits
Copy link
Owner

I would be very surprised if there is not something along these lines planned. Marco Cantú did a similar thing with a class helper for TForm in a recent blog post of his - that would be my suggested method since it's a more clean implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants