SendToBack TlistItemImage at design time or runtime in fireMonkey - delphi

In TlistView Dynamic appearance I added a few object appearanced to the item.
I have a TextObjectAppearence and an ImageObjectAppearence.
I want to set the image to be a background for the text meaning the text should be on top of the image.
I tried right-clicking on the image object and selecting SendToBack but it doesn't seem to work.
At run-time, there's also not any way to call ListItemImage.sendtoback etc.
what is the right way of doing it?
I've attached a screenshot of the two items overlapping...

The only way I found is to open fmx file in text mode and to move the various objects in the order needed (first is the deeper)

Related

Firemonkey styles - duplicate a certain style lookup to customize

In a Firemonkey project, I have a TListBox with numerous items. Depending on the state of any given item, I intend to show the Detail as either red or white (on a black background). Of course I need to use the styles to do this.
I right-click one of the TListBoxItem controls and choose "Edit Custom Style...". It's my understanding that it's supposed to produce a new copy of whatever the current style lookup is just for this one control. In my case, I had already set it to listboxitemrightdetail prior to trying to customize it. What I would expect is that when I make a change to the font color in this style and "Apply and Close", that one single list box item should get that change.
However, instead of that one, ALL of the items in this list box got that change. The change I made actually modified the listboxitemrightdetail rather than producing a copy of it just for that one control.
In the end, I intend to have two style lookups, for example listboxitemreddetail and listboxitemwhitedetail which I can toggle on each list item in runtime.
What am I doing wrong, and what's the appropriate way to duplicate a style lookup to have two different versions?

Positioning of custom list box item components in Delphi XE5, Firemonkey

I've customised the style of a Firmeonkey list box item in such a way that now it can consist of 4 TLables in it. Each of the lable has Alignment as alNone.
I'm setting position of each of them in my code whenever i need to add any item. I've observed that when my list has scroll bar and if first component is not visible (i.e. i've scrolled down enough) at that time if i re-add all the items again in list box, then the position of TLabels in first items (or items which are not shown) get distorted.
For setting positions I am using below code :
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X :=
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X + (tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Width;
Any suggesstions, how can i overcome this issue.
Regards,
Padam Jain
Firemonkey styles are repeatedly 'applied' and 'freed' as components appear and disappear from screen.
It is not enough to simply set properties of style objects once and expect those values to be remembered. What you need to do is either listen to the OnApplyStyleLookup event or override the ApplyStyle method of a custom component and use the same you have above to set the properties again.
This means you'll need somewhere to store the values you are going to set.
I would suggest for your situation that you subclass TListBoxItem so you can add suitable properties or fields and put your code in ApplyStyle.

In Xcode Interface Builder - why are the options in the Editor--->Arrange menu (containing Send to Front, Send to Back) often disabled?

What I'm trying to do is simple: bring a label in front of an image within a subview.
But all of the options for arranging are disabled/un-selectable when my label is selected. I find this happens often.
What could be the reason that I'm almost never allowed to change the z-axis of my objects in the Arrange menu? Is it a better practice to avoid this feature and set the order of views programmatically?
It can depend on how you have selected the label (similar to how the label can only be moved with the keyboard when selected in some ways).
A simple alternative is to look at the list of view in the pane on the left and to drag the views up and down to change the order.
It happens sometimes. In that situation, click the view or image you want to send back then you will see little square box at the edges of image from which you can re size your image, Just click on it once and then go to Editor > Arrange > Choose option according your need.

How to change the way selection is drawn on a image in a TListView in Delphi?

I load icons from exe/dll/ico and I display them in a TListView set to vsIcon. The images are stored in a TImageList set as TListView.LargeImages.
So each item in TListView is an image + a small text below.
The user selects one or more and clicks on a button.
The problem is that the selection of the images looks "ugly":
I want to be drawn like on the desktop when you select a shortcut:
But I need that TListView to have the same "behavior" in other situations. I say this because I know that using OnCustomDraw events is generating problems in other "areas".
And since the images are available only at runtime I can't store them in resources as "selected". But I think I can "double" the images from TImageList, if it's necessary.
Is it possible..?
Thank you.
PS: I use Delphi 7.

How to select and move multiple controls at runtime

I have created some custom controls (TCustomControl) in Delphi that I can move them at runtime but only one by one. How I can select two or more of these controls, at runtime again, and move them around all together with the mouse?
Thank you.
Another comercial solution would be from DevExpress: LayoutControl. It allows for drag and drop, grouping, full rearrange, hiding and adding of components at runtime.
If you can't find any simpler way, you can always do it manually. Keep a list of all the selected controls. When the drag operation begins, make another list, this one containing TPoint values indicating how far on both axes each control's Top and Left properties are from the mouse's position. Then, as the user drags the control, continually update the selected controls to keep them at the proper relative positions to the mouse pointer.
I once used a component named handles, that if I remember correctly wasn't too difficult to update to the later versions of Delphi and supported multi-select.
How about a commercial solution? The screen shot shows alignment tools, which would suggest that it supports multi-select.

Resources