In my Firemonkey HD application I have to edit the default style of a TButton.
Opening the TStyleBook resources I've seen that the TLayout object of each buttons have two different sub-components:
- TSubImage (it set the default background image for each component)
- TText (it shows the text)
When I try to add a TPanel, TRectangle or TImage to my TLayout I see that, after saving and applying the changes, running my application the OnClick event of my TButton doesn't work.
Any advices?
Clear the HitTest property of any components you add which you do not want to respond to mouse clicks and gestures.
Related
I am trying to add a fade-out effect to a TMemo control.
In the Form Designer it works quite well with a TLayout, TRectangle, and TMaskToAlphaEffect, as show in the screenshot on the left side. However, I would like to use the Style Designer (TStyleBook), as this seems the predestined approach and offers even more possibilities.
I have recreated it in the Style Designer, and in the Form Designer it looks as expected.
At runtime, however, the fade-out effect is not visible for TMemo styled by the TStyleBook. The "manually" styled TMemo is working fine.
As the Windows resources for the TStyleBook generates a ~83kb .fmx file, I had to upload the MCVE, which can be found on DropBox.
To do it on your own, follow these steps:
Open new FMX project
Add a TMemo to the form
Right click the TMemo and select "Edit Custom Stlyes..."
Select "background" under Memo1Style1 in the structure panel
Add a TRectangle from the component palette by double clicking
Select the Rectange1Style and change
Align to "Client"
Fill -> Kind to "Gradient"
Add a TMaskToAlphaEffect as child from the component palette by double clicking (Rectange1Style still selected)
Close the Style Designer and confirm applying the changes
If I change the Z-order of the TRectangle in the Style Designer, the effect also disappears in the Form Designer.
Am I missing something, or is it due to an incorrect Z-order at runtime, or is my approach fundamentally wrong?
I have a application with multiple stylebooks containing styles from delphistyles.com. I want to add a trackbar to allow the user to change the transparency of the form at runtime like you can do in VCL with alphablend.
This post: AlphaBlend in FireMonkey says the following:
To make your form background semitransparent you should set form Transparency property to true and use Fill.Color with alpha value like $AAFFFFFF(with Fill.Kind = bkSolid). in this case form border becomes invisible (at least in Delphi XE2)
But how can I achieve this when my form has a stylebook?
Set TForm.Transparency to True
Put TPanel on the form with Align = Content
Use your TPanel as conteiner for all controls
Use TPanel.Opacity for transparency
Another thing is when the main form is transparent how can I go about making a titlebar for the user to drag the form?
I use my own class TWindowMove for moving forms without titlebar. Thats a small demo project
I'm have TTabControl with some controls (Delphi XE7 Firemonkey app).
All works fine, tabstop too. Now I need to colorize one panel with CheckBox.
Add TRectangle to this panel and set parent for CheckBox to this TRectangle.
Interface looks fine but now this CheckBox not in the taborder list and not received tabstop command.
How to fix this issue?
How to reproduce: Add to the form TRectangle, add 3 CheckBox, move one CheckBox3 to the TRectangle using Structure panel (set TRectangle as parent for the CheckBox3). Run this application and try navigation using Tab key. You can't navigate to the CheckBox3!
You either have to manually set TabOrder to some (reasonable) value because TShape doesn't have it published and is thus set to -1 (which does the same thing as TabStop = False) or doesn't place the TCheckBox in the TRectangle, just place it in front of the TRectangle so it draws over the TRectangle.
Another option is not to use the TRectangle at all and change the style of the TPanel: Right click on the panel in the designer and select Edit Custom Style.... Then select the style newly created for you (something like panel1style: TRectangle) and change Fill property however you need. Click Apply and Close and you're done. By using styles you can create complex looks for any control that may look simple at first. For more information see http://docwiki.embarcadero.com/RADStudio/XE7/en/Customizing_FireMonkey_Applications_with_Styles and related topics.
I've created a style with the Bitmap Style Designer for Delphi XE7.
I've updated the button style to white with a blue border and duplicated it to create an orange button called Button_Copy.
I've exported the style to FireMonkey, but I can't find Button_Copy to assign it to a button on my form. How do I do this?
Also, can I rename Button_Copy to e.g. OrangeButton?
In the Bitmap Style Designer, save the style as a FireMonkey style.
Add a TStyleBook to your form.
Set the StyleBook property to the stylebook.
Double-Click the StyleBook and open your style. Close and Apply.
You can now set the StyleLookup property of a button to Button_Copy and if all is well you will see your new style.
Note that your new style won't appear in the selection list for StyleLookup - the list of available values appears to be hard coded.
And, of course you can change the name - just change the StyleName property of the top level object (probably a TLayout). The normalnaming convention is to append the word 'style', e.g. OrangeButtonStyle.
I have kept an TImage component at the Top-right corner of a bitbutton.While loading of Form some part of image is Hidden by Button as like in image .How to avoid this.? and also tell me how to find corner of a Button such that i can place my image correctly to show notification correctly in case of Dynamically loaded buttons.
Yours Rakesh.
A TImage cannot be brought in front of a TBitButton since a BitButton is a windowed control (TWinControl). Instead of a TBitBtn or a TButton, you can use a control which does not descend from TWinControl, like a TSpeedButton.
The top-right corner of a button is at (Button.Left + Button.Width, Button.Top).
A TBitButton owns a window handle and only controls with an own window handle can be placed in front of it. You could place your bitmap on a TPanel (TPanel inherits from TWinControl and has a window handle), and this panel you can bring in front of any other control. Set the BorderStyle of the panel to bsNone, so it only works as a container and is not visible.
P.S. If your bitmap is as simple as the one in your example, you could directly write onto the panel and set the colors accordingly.