Is it able to apply a ".theme" file to my app written in Delphi2009? I'm going to custom my app's look and feel, but by default, Delphi2009 has applied the UxTheme.dll and follow the Windows OS theme, what i need is to custom some components' color style, as a result, i've prepare a ".theme" file with the correct color value, but how can i apply it to the app so that it won't affect the default Windows style?
Thank you.
A .theme file contains customisation settings for an entire desktop. It is of no use for your goals. Windows does not perform per application theming. That requires custom drawing from the application, or third party add-ons like Window Blinds.
The easiest way to theme your app is to upgrade to the lates Delphi and use VCL styles, the feature introduced in XE2.
Related
In VCL I used TOpenPictureDialog for loading of image files because it's useful to see a preview when selecting from a long list of files. I also used it for loading my own binary file format by creating a class derived from TGraphic, overriding the load and draw functions and registering it with TPicture. Now I've moved to FMX and would like a similar preview, but there is no TOpenPictureDialog. My only alternative currently seems to be to create a custom form for loading these files, including the ability to browse folders, etc, which seems like a big job to replicate all the functionaly of TOpenPictureDialog. Before I do that I wonder if anyone knows of a pre-existing component that does this? I'd like to support Windows and OSX initially.
If I do end up making my own component, would it be easier to start from scratch or to derive from and extend TOpenDialog? It seems that TOpenDialog is just running the default Windows open dialog in Windows so it seems unlikely that I could do that.
This is one of the few things missing from FMX that is available in VCL.
I'm injecting a number of forms into an existing application using a dll.
I don't control the existing application, nor do I have source code for it.
(I doubt the source code exists any more).
I want to show a TextHint in a TEdit.
In the form designer this works, but in the application it doesn't.
I traced it to the fact that StyleServices (This used to be called ThemeServices (now deprecated)) is not enabled, disabling the TextHint.
Obviously I cannot enable styles for the application, all I have is a dll.
Is there a way to show the texthint?
I prefer to use a stock TEdit.
The dll is written in DX and the old application is written in D7.
BTW I don't care a hood about any additional styling/theming or the like. I just want the texthint to display.
Is there a way to show the texthint?
Standard TextHint functionality in a stock TEdit is dependent on the EM_SETCUEBANNER message, which only works when Visual Styles are enabled:
Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles.
If Visual Styles are not enabled in the app you are injecting your code into, then the only way to do what you are asking for is to subclass the TEdit window and custom-draw it manually when its text is empty.
Ok, so I downloaded a .zip file of all different kinds of examples from embarcadero... the way the buttons look and among other things are completely different from when I just create an application within my Delphi 7. I believe these examples were made for or made at a new time... because the button look way different from the way the button when I put them on my application. the buttons from the example look very modern and sleek and have mouse over effects (This applies for all the examples..its not a custom component ) I was wondering I can get this effect in my own applications within Delphi 7.. I can do this by opening one of the examples and just erasing all the code... but that's not what im trying to do..im wondering how I can accomplish these styles.. how come the examples have these nice looking buttons and such..but when I make an app within D7 its much older looking and such..
I apologize if my question is hard to understand.. and I appreciate any help on this.
Thank you in advance.. I appreciate it.
If I understand your question correctly, you're asking about the native control appearance changes that were added by the addition of Windows Themes in Windows XP.
Delphi 7 supported themes by use of the XPManifest component, which does nothing but add a manifest to your application which tells Windows your app is theme-aware and therefore it should load a more recent version of the common controls library. You can find the XPManifest component in the VCL component palette on the Win32 tab, or simply add the XPMan.pas unit to your uses clause. Note that the themed drawing does not work for all controls (grids, for instance, are not drawn using themes, and IIRC neither is TSpeedButton - it's been a long time since I used D7, so I'm not sure exactly what is and isn't supported, but the support is limited).
Starting with Delphi 2007, there is built-in support for Windows Themes, which is available by default in new projects. It can also be enabled in older projects using a checkbox in the Project->Options->Application dialog.
(Of course the real answer is that if you want your app to have the features included in modern versions of Windows, you should upgrade from your Windows-95 era version of Delphi to one that is more recent.)
Suppose I want to supply my own app icons in deployment (imagine I switch these depending on customer) is there any file name/storage pattern I should follow? Can I set set app icons programmatically or otherwise compile/runtime?
Or do I have to use the Delphi IDE to specify all the icon resources?
What I have done now is o have a shared folder where my project is configured to get icons from. I then in Window Explorer simply change icons/backgrounds found in folder. However, this is far from an ideal solution, but I suppose I should mention it as a possible answer.
In a legacy application (created in Delphi 6 under WinXP in 32-bit, recently ported to Delphi XE2 under Win7 in 64-bit) at design time, the standard controls look "modern", with color gradients etc. In run-time though, they look just like an old Win95 version.
That would not bother me much if, in particular, the default colors in TPageControl and TTabControl wouldn't make it really difficult to tell which tab is currently selected.
So my questions are:
What could make the theme not active at run time?
Is it possible to easily (e.g. through IDE configuration) make the design time look like the run time?
Note:
In the project options, I enabled runtime themes for each existing target. It didn't help.
I also tried to enable GlassFrame in the forms containing those controls. Unfortunately, the runtime look and feel stayed unthemed.
This application is built on a lot of in-house and external code that
I don't master (just a dwarf standing on shoulders of giants),
but whose source are available to me. Suspecting that some
instruction would disable themes at application startup, I looked for
some keywords like "Theme", "Skin", "TStyleManager", "SetWindowTheme"
hoping to solve this by myself. I could not find anything significant (to me, at least).
I tried to skin a small application as a test, using infos from
Question
Delphi XE2 VCL styles tutorial - how to change the style at runtime,
and it worked perfectly.
Skinning my application is not my goal. I just would like to be able to visually tune some GUI elements at design time, and it is easier if design and run time look alike.
It turns out that removing the line "{$R *.res}" in the dpr file had made the themes unavailable.
Under D6, I disabled version information in the project and replaced "{$R *.res}" with "{$R 'myApp.res' 'myApp.rc'}", to use my own rc file to have the version information in a separate, easy to edit file, and not to be forced to go through the project options.
Under XE2, that did not work anymore because the resource would often be overwritten (or not taken into account, I'm not quite sure) by Delphi during the build. I had to rename the rc file so that it does not match the application name, thus replacing "{$R 'myApp.res' 'myApp.rc'}" with "{$R 'myApp_rc.res' 'myApp_rc.rc'}".
Putting the "{$R *.res}" again (along with "{$R 'myApp.res' 'myApp.rc'}") seems to make things right with themes and not break the version information.
Thank you Brian for having me look in the good direction.
In my experience this is often due to project differences between DEBUG mode (used by default when in the IDE) and RELEASE mode. Open your project options and scroll to application (where themes styles and icon are defined). Notice that the platform and build option combo at the top holds separate values for each setting and I expect you will find that your DEBUG build config has runtime themes enabled but RELEASE does not.