SysListView32 like mouse selection rectangle - delphi

Can I make a mouse selection rectangle in a List View like in a SysListView32?
Is there a way to work with a SysListView32 and use it in Delphi?
Thanks!

You need to set LVS_EX_DOUBLEBUFFER style of the list view (only applicable with comctl32.dll version 6.0 (XP) and later):
[...] This extended style also enables alpha-blended marquee selection on
systems where it is supported.
uses
commctrl;
..
ListView_SetExtendedListViewStyle(ListView1.Handle, LVS_EX_DOUBLEBUFFER);
It also works with the TShellListView component included as a demo. See this answer to find out how to find and install the shell controls.
(PS: Don't forget to set Multiselect to true)

The site appears to be down currently, but there's a Delphi ListView component available for free from Mustangpeak that has this feature and more that are found in the modern Windows list view.

Related

Delphi XE5 Android TButton colors

I need change color of 50 buttons in one form.
Every button another color and color want to set by code(no design editor).
It is firemonkey mobile application.
By my opinion, without making your own button that doesn't use FMX styles completely (which would break multiplatform compatibility if you are looking forward to support multiple platforms with their native styles), you may apply some filter on top of each of those buttons but on some styles this may cause the text not to be visible, implementing your own filter might get you the desired result:
Effect:=TFillRGBEffect.Create(Self);
Effect.Color:=$80FF0000;
Effect.Parent:=SomeButton;
Another way would be to take advantage of TColorButton with TText on top of it, but this way the entire button won't be filled with your color, but you can modify default/custom style for each platform in order to get what you need (this indeed needs to be done in the designer but you would have to create just one style for each platform you need to support and not 50 for each button):
Button:=TColorButton.Create(Self);
Button.Color:=$80FF0000;
Text:=TText.Create(Button);
Text.Parent:=Button;
Text.Align:=TAlignLayout.alClient;
Text.Text:='Hello';
Text.HitTest:=false;
Button.ClipChildren:=true;
Button.Parent:=Self;

Delphi XE2 modern looking MainMenu

I am trying to modernize the look of our older Delphi 7 application now that we are using Delphi XE-2. I experimented with the TRibbon, and although I like it, it probably is not the correct solution since we currently use a TMainMenu and make many runtime changes to it - our users can modify the main menu. But the default Mainmenu looks old, especially compared to the image shown.
What I am trying to do is something very close to the attached image, especially with the background color, but I don't quite understand how this was done. Can anyone tell me if this example (the File/View/Insert section) uses a TMainMenu, or is it Buttons on a Toolbar ? If we require a customizable main menu, do you think the example shown is an option ?
This example image comes from DevExpress Print Sample library.
Edit : I am new here so I can't include the image. Here is the link :
http://www.devexpress.com/Products/VCL/ExPrintingSystem/gallery.xml
The second image, the green one that says "Print Preview".
You could use the TActionMainMenuBar but the simpler solution for you is to Use Vcl styles, pick a theme, modify the graphical properties of a MainMenu component and then use StyleHooks to force the style just for the MainMenu component without using it for the whole application.

Chevron button in delphi dialog form

I want to draw a Chevron button
in a custom dialog form and I'm wondering if exist a State and Part constant to be used with the DrawThemeBackground function or I must draw this kind of button manually?
The closest I can find for XP is
ThemeServices.DrawElement(Canvas.Handle, GetElementDetails(tebNormalGroupExpandNormal),
Rect(10, 100, 100, 200));
or
EBP_NORMALGROUPEXPAND using DrawThemeBackground directly. However this draws a double arrow (on XP at least)
However later windows versions also have TDLG_EXPANDOBUTTON, which is what you want judging by the image at Where do I find the icons / animations recommended in the Windows 7 UX guide?
Thanks to Andreas (as usual for theme and customer drawing related questions)
See also his utility at Windows Visual Themes: Gallery of Parts and States?
Ideally I would use the second version if available, but fall back to the first on XP.
You can't find it in the list of Parts and States? Then it doesn't exist. http://msdn.microsoft.com/en-us/library/bb773210(v=vs.85).aspx

Delphi Application.HintColor

In Delphi 2010 (don't know about other versions) Application.HintColor seems to have no effect when running on Windows 7. On XP it gives the desired color. Any workarounds for this?
HintColor is like some of the other *Color properties in the VCL in that if you are running a themed application on a themed OS, they may be ignored when painting the control. Hints are a little different, because for them it's Vista or above, not XP or above. You can see this if you look at THintWindow.Paint in Controls.pas - it specifically paints the Vista gradient background if it's Vista and if themes are enabled.
This is normally a good thing, because you want your application to fit the look-and-feel of the OS and the user's preferences.
If you really want to override this, you will need to:
Subclass THintWindow
Get your application to use this new hint class when showing hints
In this class, override the painting methods to draw as you wish
Create a new hint class descending from THintWindow somewhere (more on what to implement below.) To get the application to use your new class for hints, assign an event handler to TApplication.OnShowHint (the easiest way to do this is via a TApplicationEvents component on your main form) and change the HintInfo parameter's HintWindowClass field to be your new class.
In your new hint class, you will need to override Paint and NCPaint. NCPaint will paint the border, and you will want to paint a non-themed border (probably using DrawEdge.) Change Paint to fill in the background with your colour of choice, and then draw text using DrawText in the hint's rectangle with appropriate text wrapping and alignment flags. If you look at the VCL code closely you can see a couple of rectangle offsets hardcoded, and you probably want to mimic these to get the same rectangles in your code as the VCL uses.
You can make all sorts of interesting variations of hints using this technique. One I made recently changed the painting so it drew a bold caption and then had other information under that, for example.
Finally: why are you setting the colour? Is it to warn the user of something or provide some other feedback? If so, consider using more than the colour - you can change anything you want about a hint using this technique. Try painting a warning icon or using rich-formatted text instead. I'd recommend you try to keep to the general theme look, and code tweaks to the themed painting, not overriding it entirely, because unless there's a very good reason you should try to keep to the OS / look the user has chosen.
No, not directly. If you have the runtime themes enabled it will take the system color for the hint. (IOW, the hint will be 'themed'). It is like setting a color for a button with the themes enabled (given that you can do this).
However you can use other 'hint' engines. For example you can use TjvBallonHint and/or TjvDesktopAlert (perhaps in conjunction with TjvDesktopAlertStack) from JEDI's JVCL which is free. There are also other (free & paid) alternatives. Also, if you want you can implement your own hint window.
HTH
Turning the 'enable runtime themes' off makes it work.
In Delphi 2010, you have TCustomHint class. You can derive a new class from it which draws a new type of hint.
You can assign your new class to CustomHint property of your forms or any other controls, and Delphi will use your custom hint class for showing hint for that control.
You can check source code of TBalloonHint class which is a sample TCustomHint descendant in Controls.pas

Where can I find a movable toolbar demo?

At the top of the Delphi IDE is a toolbar with buttons grouped together on little movable trays. I'm trying to implement something like that, but not having much success. I've found TToolbar, but I can't figure out how to set up the movable trays. Does anyone know where I could find a simple demo app that shows how it's done?
I believe the webbrows.dpr located in the cool stuff demo directory (and included in all installs of Delphi since around Delphi 6 or so) contains just the demo you are looking for. This gives you the effect your looking for using only CodeGear supplied components. You add multiple bands and set the fixed size to false for the bands you want to allow to be movable.
You can try the Toolbar2000 Component from Jordan Russell or the TBX package wich is an extension for Toolbar2000 components.
Toolbar2000 is a set of components for CodeGear Delphi and C++Builder designed to mimic the Office 2000 look and behavior. It includes draggable and dockable toolbars and menus.
alt text http://www.indasoftware.com/_files/img/fordev/office2003/small_classic.png
you can see these links.
Office2003 Theme for TBX
Mac OSX Theme for TBX
TBX themes
Bye.
You can put your toolbars in a standard VCL TCoolBar or TControlBar. AFAIR this can get a bit messy sometimes. For an example, have a look at the CoolStuff demo, as skamradt suggested.

Resources