Delphi XE5 Android TButton colors - delphi

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;

Related

Change the selected colour of combo box in delphi firemonkey

I have created application using Delphi 11.2 firemonkey for windows. In that i'm using Combobox. When the list opens, the background color of the items is blue by default, I would like to change this color
change the background color of the items
I agree with Steve, changing style for the combobox item style is really hard. You have to, first, access to the underlying listbox (hiden in the TCustomComboBox parent), and then change the ListboxItemStyle.ActiveStyleObject (I guess). This is not a good way I think.
I prefer a different approach : using a TEdit joined to a TlistView (or a Tlistbox)
my French blog here
this way it's easy to play with colors (look at some others posts in the same blog)

Can I enlarge the menu font size in Delphi 2?

Everything I've found says I can't do this with Delphi 2's TMainMenu but if somebody here has managed it somehow, I'd really like to know the trick. I found code that changes the System menu font size but none that confines the change to only the application. Anyone here know how to do this or do I have to just accept Delphi 2's tiny menu font size that appears on today's large screen monitors? (Moving the app to an upgraded Delphi is not the answer I need ;-)
The only way to achieve per application custom menu fonts is with an owner drawn menu. Delphi 2 does not support owner drawn menu items directly in the VCL properties of a TMainMenu component. This support was introduced only in Delphi 4.
You could still implement an owner drawn menu, but it would involve implementing them using standard Windows API techniques, and handling the required messages on the forms which own the menus involved. It is not especially difficult but not as straightforward as the event based implementation available in Delphi 4 and later.
You can still use a TMainMenu to define your menus but in your application you would then need to programmatically set the owner draw flag on the menu items and handle the resulting messages appropriately. Doing this, you will need to handle all aspects of drawing the menu - you cannot simply set/change the font and leave the system to draw the menu items. You may also need to provide additional handling for any keyboard shortcuts you have set up.
If this is a viable approach then information on implementing owner drawn menus at the API level can be found here.

VCL style mac look style designer

Recently I've been doing some research in to VCL Styling (Embarcadero XE2 for Delphi).
I can load and set the styles so that works fine.
Currently I'm exploring the VCL Style Designer and what I try to figure out is how can I move the minimize, maximize, resize, close and help button to the left instead of the current default right while the application text (caption of the form) is on the right.
I am at my whits end and hope some one can give me some pointers.
So basically what I try to 'emulate' is the Mac look on a Windows form.
Any help is welcome.
What do you want accomplish is not related to the VCL Style Designer, instead you must create a custom form style hook.
Follow these steps.
Create (and register) a new form style hook descending from the TFormStyleHook class.
Override the PaintNC method to draw the title buttons in the new positions.
Handle the WM_NCMOUSEMOVE, WM_NCLBUTTONDOWN and WM_WM_NCLBUTTONUP messages to detect the status of the title buttons (hot, pressed) and fire the actions (close, restore, maximize, minimize).

Custom Dock in Gimp

In GIMP: is there a way how to make my own custom dock (toolbar) where a could put my most used functions?
Something like this:
Create new empty dock or toolbar
Somehow set what functions will be in it
(any of the functions, no matter it has an icon or where in menus is located)
I'd like to have it so I don't have to search in menus every time I need something. I'm aware that I can make keyboard shortcuts but they are difficult to remember since I don't use Gimp every day. I'm used to this from Corel Photopaint and I think it is really useful.
Thanks for your suggestions.
In GIMP 2.8, you can only customize the dockable dialogs - by dragging then around, and in another level, customize tool presets and make use of the tags in the presets dialog to quckly access paint-modes with set brushes, gradients and painting dynamics - so, keeping the tool-presets dialog around, and appropriately using the tags can give you quick access to these settings.
You can't, however, add additional menu entries or icons to select particular plug-ins (filters) - and access those from any of the dockable dialogs. without rebuilding GIMP, you could edit the XML files at /usr/share/gimp/2.0/menus to customize your menus.
In the master branch, the unstable "GIMP 2.9" which will eventually become GIMP 2.10, there is a "search" action implemented, initiated by pressing the / character that will probably make it for the need to quickly find-out any operations wanted.

Positioning controls in Delphi 5 so they fill the form client area when the form is resized in the same sort of proportions as they did initially

I have a DBGrid above a group box with some buttons and edit fields and another group box below that again with some buttons. I cannot fins a setting for the align and/or anchors for the DBGrid and the group boxes so they fill the form without overlapping or leaving blank bits of form.
I am using Delphi 5 on XP Pro with all updates installed.
If I remember, there is no built-in way to do this. When I did this in Delphi I implemented it manually in the event handler for the form resize event. You can recalculate the new positions for each control based on the size of the form and the proportions of the layout you want. You can simplify it by breaking the form in to panels and setting most of the controls to align to one or more edges of their parent panel. That way you mostly just have to resize a few panels. If you have a complex form you still might need to reposition some individual controls.
You might also find a third-party container control out there which makes this easier. I would search for combinations of "flow", "layout", "table", "container".
We've struggled with this as well, and I agree with Charles M that there is no built-in way to do this.
If you're looking for an outside solution, the ExpressLayout control from Developer Express allows you to fine-tune the positioning of controls on Delphi forms. They advertise "Screen Resolution Independence - Automatically Resizable Interfaces - Look & Feel Standardization...", so it might be worth looking into.
I've never used that particular control, but we use a lot of other Developer Express controls in our commercial projects. The controls and support are excellent.
See: http://www.devexpress.com/Products/VCL/ExLayoutControl/
They don't have a trial version, but do have a 60-day no-questions-asked money-back guarantee.

Resources