How make DBLookupcombobox has a Windows 7 Look with RAD 2010? - delphi

I'm using RAD 2010 on windows 7 and all visual components looks normal (Edit, DBCombobox, for example) but the dblookupcombobox has the same border theme from Windows XP. I can't find how make it's looks like the other components. Anyone has any idea of how i can make this?
Thanks PS: Sorry by the bad english.

I have discovered that the reason for this behavior it that TDBLookupComboBox is a descendant of TCustomControl. Most similar controls are descendants of TCustomEdit, TCustomComboBox or TCustomListBox, which all call TWinControl.CreateSubClass to utilize a preregistered System Window Class of EDIT, COMBOBOX, and LISTBOX, respectively.
Since neither TDBLookupComboBox nor any of its ancestors do this, it just gets a plain border drawn due to the WS_BORDER flag in its Params.Style.
I'm going to assume there is a valid reason that TDBLookupComboBox does not call CreateSubClass to get a Windows COMBOBOX, but I'm not sure why. Maybe a future version of the VCL will utilize this.

Related

How to patch TSpinEdit to use Vista/Win7 visual style?

Win7 must give ok style for TSpinEdit, but I see outdated style:
So arrows are not themed, and buttons are old.
I use Delphi7. How to patch VCL to fix style?
OK is:
I don't know if Delphi 7 already had it but you can use TEdit in combination with TUpDown and then set the Association property of the TUpDown to your TEdit.
TSpinEdit is a custom VCL control. There is no Windows control with that functionality. Even in the latest version of Delphi it looks exactly the same as in Delphi 7. And it's really rather ugly isn't it?
The control, in modern Delphi, is implemented in a unit named Vcl.Samples.Spin. Looking at the documentation for the Vcl.Samples namespace we have:
Contains the units for several sample VCL components delivered with RAD Studio - a calendar, an outline, a gauge, and a spinbutton.
The unit will be named differently in Delphi 7, but the principle is the same. These are sample controls, supplied with source code.
So, what you may do is take a copy of the TSpinEdit code, and modify the painting. Change the button drawing to be how you wish it to be.

Is there a Plugin for Better Filtering the Delphi 2006 Component Palette items?

I have hundreds of components in my Delphi 2006 installation, but I always have trouble finding those I haven't used before and that may be the solution for what I need at the moment. I have many undocumented packages, but by the name of the component you can have an idea of what it does.
For example:
I need a RadioButton, so I have TRadioButton, TElRadioButton or TAdvRadioButton to choose which one has the custom properties that I need.
But when I click the Filter Button of the Tool Palette, I have to Type from the beginning of the component name. If I could have a field editor where I could type only a part of the name and the Palette showed me the components that had that term in the middle of the name too, I would make my day!!!
Does anyone know how in Delphi 2006?
I know that Delphi XE2 has this filter field.
The DDevExtensions IDE extension (http://andy.jgknet.de/blog/ide-tools/ddevextensions/) has a Component Selector that does what you need
(also using D2006, so it definitely works)

Tool palette component

Is there a component I can download or buy that looks and behaves like the Delphi IDE tool palette?
What I need is a component similar to this to display different items under different categories.
The items I want to populate it with are not components like TEdit, TButton etc but just regular list items which could be anything, and could have any custom icon.
Could anyone suggest or recommend me to any available components like this?
I am using Delphi XE.
What do you know I have discovered the component TCategoryButtons actually inside Delphi.
This seems to be the same type of component.

Transparent checkbox with theme-support?

I'm looking for a simple, transparent checkbox component that properly supports XP/Vista/7 theming.
It should also work with Delphi 7.
I've found a component on Torry's that's not working properly, and I know that Raize components has a transparent checkbox - but I'm obviously not going to pay $300 for the entire package just to get this single component.
I've also found many other solutions, but none of them support theming.
The main problem is that TCustomCheckBox is a TWinControl descendant, and in order to implement transparency, you need to make a new TGraphic descendant control from ground up.
Any ideas?
LMD-Tools SE is free, works great on Delphi 7 and has a checkbox component that has a transparency property. I've recently used TLMDCheckbox with its transparency property enabled with Delphi 7.
http://www.lmdinnovative.com/download/index.php#LMD
Download file: setupse10d7.zip. Sorry, I can't post the whole path (url) since I don't have enough juice yet.
This should fix you up :).
ShawnH.
Raize Components is overkill for just this component, but much more capable and supports transparency in a whole load more components. Once you have it, you'll appreciate the other items greatly. I'd say it is the solution you are looking for.
If you can accept an alternative control there is JvXPCheckCtrls.pas with its TJvXPCheckbox component in the JVCL library. http://jvcl.delphi-jedi.org
I think (if I remember correct) it is transparent when themes are used.
It's quite a large package which will add to vcl with the installation of Jvcl. And it doesn't cost you a cent.
But remember, the TJvXPCheckbox component is part of their XP-controls package and you cannot simply lift out the component as a standalone. You will need the installation of Jedi and to get the core code and necessary theme handling to use it.
- Its Mozilla Public Licence ("MPL") version 1.1.
I use AlphaControls for some of my programs - all of their components are skinnable and have reasonably powerful graphics handling options. A lot of the components also have more features than their corresponding Delphi standard components - some I just use for those functions alone. There's a free Lite version available at www.alphaskins.com - it may just be what you're after. It's not Vista/7 theme-aware, mind you. We use Delphi 2010 and vista/7 theme awareness is built into the standard VCL there, although that's probably not the solution you were hoping for.
Not sure if this will help, but I ran into what I think is the same problem when working with the TMSSmooth controls: the label of a checkbox place on a form looked terrible because it was not transparent.
Their demo/example programs had nice looking checkboxes so I took a look at their sample code.
Turns out they reduced the width of the checkbox component to 13 so that only the box itself and no caption shows. Then they added a TLabel for the caption.
Seemed like a clever workaround to me.
Hope this helps.

Why don't I get hotkey underlines in a Delphi TMainMenu

In a Delphi 2007 program I am using a TMainMenu referencing actions in a TAction list. I have prefixed the hotkeys of all main captions with an ampersand:
&File | &Edit | Ev&aluate | ...
In design view these hotkeys are underlined as I would expect, but when I start the program they no longer are underlined but they work nonetheless. In contrast to this, for all the submenu icons
&File
&New ...
&Open ...
the underline is shown as expected.
I am aware of the Windows pisplay properties option "Hide underlined letters or keyboard navigation until I press the Alt key." and have disabled it. In all other programs this works fine, including the Delphi IDE.
If I create a new VCL appliation and just add a TMainMenu and a few menu items, it works as expected.
This has me baffled, really.
Is there any property of the TMainMenu component or maybe an application option that I must change? The "Enable runtime themes" project option is grayed out for some reason, might that be the problem? If yes, what causes this?
This may not be a Delphi issue. I have just tried this with IE8 on WinXP. On my machine, with the display properties set to require the Alt key, the underlining works as expected. However, with the checkbox unchecked, the underlining never appears on the main menu items (even when using the Alt key), but always appears on the File,Edit,View etc submenus (as you describe) ........ unless Microsoft wrote IE8 in Delphi :-)
I asked the same question last year and there were some excellent answers:
Menu Accelerator Keys Not Showing Up Delphi 2009
In conclusion, it appears to be a Delphi bug, and I reported it to Embarcadero at:
http://qc.embarcadero.com/wc/qcmain.aspx?d=68816
However, they have no resolution to it, so unless others (maybe you) also complain, I don't expect it will get addressed.
Step's answer to my question refers to a possibly related bug reported on the Delphi forums:
ALT Key press causes controls to disappear under Themes in Vista and XP. This one is marked as "resolved" with several possible fixes listed in the comments. I have not had the opportunity to go through these.
By the way, since I asked that question last year, I got a new computer with Vista. The same problem still happens, even when the Vista Ease of Access Centre setting: "Underline keyboard shortcuts and access keys" is set. So the Delphi bug still exists.
I was very surprised to find the default was that this was unchecked. I guess in Vista, they want a cleaner looking menu with the assumption that not many people ever used the accelerator keys.
The easiest way to fix this problem seems to use TJvMainMenu from the jvcl instead of TMainMenu. I tried the current version 3.38, but it is possible that the problem was fixed already in earlier versions. Since I was using the jvcl anyway it does not add much to my program's size. Your mileage may vary though, the jvcl is a huge library.
Uses an empty image list for main menu, if it is possible. In this way you can force delphi to paint menu correctly. (But looks ugly in vista and w7)
Are you sure you don't have OwnerDraw set to true in the MainMenu?

Resources