How to create a style for an unstyled control - delphi

I'm currently messing arround with Embarcadero's Bitmap Style Designer on Delphi 10 Seattle.
As far as I know, you can mess arround with the objects that Embarcadero gives you, but when it comes to the yet unstyled parts of the control nothing can be found.
Also, I know there are ways to create new object styles, more details in its docwiki.
Just so you can know what I'm talking about:
Now, my question is: Is there a way to create a Style for the area circled in red?

Related

Delphi TListBox iOS making new itemstyle/behavior

I need to show custom data. For example I need to show a contact list with name, description, photo. And ideally I would also like to show custom data there, e.g. a button to launch telephone call. The default styles do not quite do what I want, but fairly close.
Thus, as far as I can tell, TListBox could be a decent control for this if I could create custom styles? Is that possible? (Anotther problem of course is setting the values of the custom data controls.)
You should take a good look at the FMX CustomListBox example AFAIK even the example alone already seems to have exactly what you need, already set in place.
It took me about 10 minutes to produce this result straight out of the CustomListBox example with your description:
One thing that the included FMX example demonstrates perfectly is how easy it is to add any FMX control to the ListBox via the TStyleBook Layouts such as buttons, images etc... basically any visual control upon which you then implement the HitTest, again, all very detailed in the FMX Delphi example.

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.

Flyout window similar to "code parameters" in Delphi IDE

Delphi IDE's "code completion" feature includes a second flyout window with code parameters - the one on the right:
An interesting feature of that window is that it is automatically sized to fit the content. What parameters must be used to create a window like that, and how can the automatic sizing be achieved in Delphi (XE)?
I would call that a hint window. Sizing "automatically" is done by code, and not by parameters alone, unless those parameters are properties in components, and the components then take on the work of auto-sizing to fit the content. In fact, that's probably what you want.
You could do it all yourself in Raw Win32 API terms... But it's a lot of work. Sizing a window to fit text can be done, using a window without a border and with style WS_POPUP set, and by painting it all yourself, and using the DrawTextEx API which can return the size of the text, but the simpler approach would be to use a hint window component, some of which will let you size them based on the content inside them. Unless you have a real need to reinvent the wheel, there are lots of hint window components already written. Use one.
I have used, and can recommend the hint window components from TMS (commercial) and JEDI JVCL (free), and they can both do window hints much like the above. The TMS Html Hint and TMS Office hint components are both capable of result similar to the above.
If you need a free solution, TJvHintWindow, built into the JVCL doesn't have as much functionality as the TMS ones, but could be tweaked and modified with a little work, to do something much like the picture you've shown.

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