How to add missing borders to FMX controls? - firemonkey

I'm currently designing an FMX app with C++Builder. For some reason, when the app is built and launched (it looks normal in the editor), the upper and left border of TComboEdits are missing. Same for the right border of grids. This is quite unpleasant to the eye, how to change that?
Here is the design-time settings for one of the TComboEdits:
object SearchLotComboEdit: TComboEdit
Touch.InteractiveGestures = [LongTap, DoubleTap]
TabOrder = 2
ItemHeight = 19.000000000000000000
ItemIndex = -1
Position.X = 72.000000000000000000
Position.Y = 40.000000000000000000
Size.Width = 361.000000000000000000
Size.Height = 26.000000000000000000
Size.PlatformDefault = False
OnChange = SearchLotComboEditChange
OnTyping = SearchLotComboEditTyping
OnKeyDown = SearchLotComboEditKeyDown
I added pictures of what it looks like:

I have the same problem om my computer.
The problem is due to the fact that FMX does not paint some controls (e.g. Listbox misses right border) correctly when your Windows scaling isn't configured at 100%.
It probably depends on your screen resolution as well.
Try 100%, 125% or 150% scaling and observe if there are any differences.

Related

How can I find out what the default (and only available) border width is on Xamarin Forms Frame?

I would like to know what the value of the border width is and where it's set in the code.
Can anyone point me to this value / area?
Apparently it's not being used by Frame
// not currently used by frame
double IBorderElement.BorderWidth => -1d;
the Android renderer uses a StrokeWidth of 1
paint.StrokeWidth = 1;
so does iOS
Layer.BorderWidth = 1;

SCNView Re-sizing Issue

I am trying to render 3D bar chart in SCNView using ScreenKit framework.
My rendering code is,
int height=10,y=0,x=0;
for (int i=0; i<10; i++) {
SCNBox *box1 = [SCNBox boxWithWidth:4 height:height length:2 chamferRadius:0];
boxNode1 = [SCNNode nodeWithGeometry:box1];
boxNode1.position = SCNVector3Make(x, y, 0);
SCNMaterial *material = [SCNMaterial material];
material.diffuse.contents = (NSColor *)[self.colorArray objectAtIndex:i%6];
material.specular.contents = [NSColor whiteColor];
material.shininess = 1.0;
box1.materials = #[material];
//boxNode1.transform = rot;
[scene.rootNode addChildNode:boxNode1];
x+=6;
height+=10;
y += 5 ;
}
I can render but while re-sizing the view the chart bars goes to the center of the view.
I need to render the chart, which cover the margins of the view and when Re-size it have to change accordingly. The image(s) below shows my problem.
Original Image:
Image where less stretching of both windows:
Can anyone please help me to fix the issue.
The the windows in the image that you had linked to in your original question was very stretched and that made it very hard to see what was going on. When I took that image and made the windows less stretched it was easier to have some idea of what is going on.
I think that you are seeing a general resizing issue. Either you are using springs and struts and have configured flexible margins on the left and right or you are using auto layout with a centered view with fixed width.
I assume that the red boxes that I have drawn in the image below is the bounds of your scene view in both these cases. You can easily see if this is the case by giving the scene view a different background color and resize it again.
My solution to your problem would be to change how your view resizes as the window resizes, to better meet your expectations.

PopUp in Windows Phone 7

I want to use popUp element in windows phone (C#) to view a message on screen
I did the following:
popUpBanner = new Popup();
popUpBanner.HorizontalAlignment = HorizontalAlignment.Center;
popUpBanner.VerticalAlignment = VerticalAlignment.Center;
But the popup element appears in the top left of the screen .. not at the center
How can I solve this
In Windows Phone the Pop up is not a UserControl class. Instead of centering the popup you want to center the ui elements within the popup's child element...
To be more specific, I updated my code and hope it helps you.
First lets get the screen size(i.e. Width & Height)
var width = System.Windows.Application.Current.Host.Content.ActualWidth;
var height = System.Windows.Application.Current.Host.Content.ActualHeight;
Lets create a StackPanel, adding background color to it and re-sizing the StackPanel according to the device screen resolution.
StackPanel stackPanel = new StackPanel();
stackPanel.Background = new SolidColorBrush(Colors.Gray);
stackPanel.Height = height / 4;
stackPanel.Width = width / 2;
Finally Create a Popup and add it as a children to the StackPanel.
Popup Popup1 = new Popup();
stackPanel.Children.Add(Popup1);
ContentPanel.Children.Add(stackPanel);
Popup1.IsOpen = true;
You are done. Modify your StackPanel size according to your need, since you got the screen resolution here.

Time Machine style Navigation

I've been doing some programming for iPhone lately and now I'm venturing into the iPad domain. The concept I want to realise relies on a navigation that is similar to time machine in osx. In short I have a number of views that can be panned and zoomed, as any normal view. However, the views are stacked upon each other using a third dimension (in this case depth). the user will the navigate to any view by, in this case, picking a letter, whereupon the app will fly through the views until it reaches the view of the selected letter.
My question is: can somebody give the complete final code for how to do this? Just kidding. :) What I need is a push in the right direction, since I'm unsure how to even start doing this, and whether it is at all possible using the frameworks available. Any tips are appreciated
Thanks!
Core Animation—or more specifically, the UIView animation model that's built on Core Animation—is your friend. You can make a Time Machine-like interface with your views by positioning them in a vertical line within their parent view (using their center properties), having the ones farther up that line be scaled slightly smaller than the ones below (“in front of”) them (using their transform properties, with the CGAffineTransformMakeScale function), and setting their layers’ z-index (get the layer using the view’s layer property, then set its zPosition) so that the ones farther up the line appear behind the others. Here's some sample code.
// animate an array of views into a stack at an offset position (0 has the first view in the stack at the front; higher values move "into" the stack)
// took the shortcut here of not setting the views' layers' z-indices; this will work if the backmost views are added first, but otherwise you'll need to set the zPosition values before doing this
int offset = 0;
[UIView animateWithDuration:0.3 animations:^{
CGFloat maxScale = 0.8; // frontmost visible view will be at 80% scale
CGFloat minScale = 0.2; // farthest-back view will be at 40% scale
CGFloat centerX = 160; // horizontal center
CGFloat frontCenterY = 280; // vertical center of frontmost visible view
CGFloat backCenterY = 80; // vertical center of farthest-back view
for(int i = 0; i < [viewStack count]; i++)
{
float distance = (float)(i - offset) / [viewStack count];
UIView *v = [viewStack objectAtIndex:i];
v.transform = CGAffineTransformMakeScale(maxScale + (minScale - maxScale) * distance, maxScale + (minScale - maxScale) * distance);
v.alpha = (i - offset > 0) ? (1 - distance) : 0; // views that have disappeared behind the screen get no opacity; views still visible fade as their distance increases
v.center = CGPointMake(centerX, frontCenterY + (backCenterY - frontCenterY) * distance);
}
}];
And here's what it looks like, with a couple of randomly-colored views:
do you mean something like this on the right?
If yes, it should be possible. You would have to arrange the Views like on the image and animate them going forwards and backwards. As far as I know aren't there any frameworks for this.
It's called Cover Flow and is also used in iTunes to view the artwork/albums. Apple appear to have bought the technology from a third party and also to have patented it. However if you google for ios cover flow you will get plenty of hits and code to point you in the right direction.
I have not looked but would think that it was maybe in the iOS library but i do not know for sure.

Skin Dialogs when using XP Themes?

I have been skinning dialogs by using the WM_CTLCOLORSTATIC, WM_CTLCOLORBTN messages as such:-
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
hdc = (HDC)wParam;
hwndCtl = (HWND)lParam;
SetTextColor(hdc,RGB(0xff,0xff,0xff));
SetBkMode(hdc,TRANSPARENT);
pt.x = 0;
pt.y = 0;
MapWindowPoints(hwndCtl,_hwnd,&pt,1);
x = -pt.x;
y = -pt.y;
SetBrushOrgEx(hdc,x,y,NULL);
return (INT_PTR)_skinBrush;
This code sets the text color to white for all static elements as the background brush paints a low contrast image.
Ive (only) recently updated to use Common Controls 6 and the XP-Themeing look on my dialogs but all the text on controls has 'dissapeared' as its being drawn in the default black again.
Is there some other way to control the text color of controls under xp-themeing? Or do I need to consider ownerdraw now :-( ?
(And owner draw is really NOT an option - If I ownerdraw all my controls the entire motivation for switching to common controls 6 in the first place falls away).

Resources