iPad: Is there a frame like the GroupBox in C#? - ipad

I'm new to iPhone/iPad development. I'm looking for a way to visually groups some controls just like the GroupBox in C#. I know it doesn't make much sense in iPhone due to limited space, but my app is for iPad only and customer wish to see that. Any idea?

Not directly. You could simulate it with a Label and a UIView with a little bit of custom drawing (just to draw the border, and an inner shadow if you'd like).

Related

autolayout- different devices and rotation

I am absolutely new in iOS programming. I wonder if a View contains 4 narrow rectangle subviews where they are constraints to four sides, like a picture frame, if I can make this program works in portrait, landscape; in all devices, iPad, iPhone( different version). The reason I am asking is to find out if not possible to consider concentrating and finding out about the possible options.
thanks
Yes, auto layout will do it. you might want to take a look at this tutorial to get started:
https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2

Resolution independence in Xamarin for iOS

I'm taking a few first steps in Xamarin for iOS and having a very hard time figuring out how to create a view that is resolution independent.
I have a single textbox in the view, aligned so that its edges meet the edge of a iPhone 6S. When I change the View to a Iphone 4S the edges of the textbox are outside of the view.
I have tried to drag the constrains to the edges, pretty much clicked every button and tried to find some example of how to make it so the view resizes to fit the viewport but I cannot make it work. Ive also fiddled with the different modes of the View (Aspect Fit, Scale to Fill, etc) but that makes no difference.
I would love to se a simple example of how to create a resolution independent or multi-resolution form or view that is displayed similarily no matter the screen resolution on the iPhone.
Having gone through very much the same pain as you, my recommendation is two-fold:
Have a look at the Cirrious FluentLayouts package, which you can
get from NuGet.
A tremendous help in simplifying various issues with auto-layout, especially if you decide (like I did) to just give up on the GUI layout tools and go with a full programmatic approach.
It will allow constructs like:
this.AddConstraints
(
_navBar.AtTopOf(this, UIApplication.SharedApplication.StatusBarFrame.Height),
_navBar.AtLeftOf(this),
_navBar.WithSameWidth(this),
_navBar.Height().EqualTo(Hamburger.HamburgerHeight),
_scrollView.Below(_navBar),
_scrollView.AtLeftOf(this),
_scrollView.WithSameWidth(this),
_scrollView.Bottom().EqualTo().TopOf(_pageControl),
_pageControl.Above(_toolBar),
_pageControl.AtLeftOf(this),
_pageControl.WithSameWidth(this),
_pageControl.Height().EqualTo(pageControlHeight),
_toolBar.Above(_button),
_toolBar.AtLeftOf(this),
_toolBar.WithSameWidth(this),
_toolBar.Height().EqualTo(toolHeight),
_button.AtRightOf(this),
_button.AtBottomOf(this),
_button.Height().EqualTo(buttonHeight)
);
Be aware that since... iOS 8 I believe? ... you now need to use a
LaunchScreen.xib to have your app correctly pick up device
resolution which will then be used by auto-layout.
This was the one area I still needed to use the graphical layout tool for - just once, happy to say.

Rotate VCL components in Delphi XE2

Now I adapt my app for tablet PC. I ask how can I fixate form when the screen was rotated. Good people says that I must adapt my app for portrait orientation and they're right.
Some forms is very specific and it's very hard (maybe impossible) to re-design they for portrait orientation. So I think I can create a illusion that my app works only in landscape orientation.
That's why I need rotate standard VCL components in Delphi XE2. For example for standard memo I need write text not only from left to right (or right to left) and from up to down (and from down to up).
Also I need rotate button. Now I use standard TButton and TRxSpeedButton.
I think enough to rotate the text for TButton but I don't know how I can do this?
In case of TRxSpeedButton I use glyphs. In theory maybe I can override canvas and change pic. Another way is create 2 buttons (one for portrait orientation, one for landscape. Each one will have their special glyph) and change their visibility. But I don't like 2nd variant because in this case exe file will be very plump, I don't like plump exe))
Thanks for advises.
You've no realistic chance of making this work using standard VCL controls. VCL controls don't have a mode that allows them to be rotated through 90 degrees. I see no easy prospect for making any control that displays text do so rotated. That's just text output. What about text input? There's also the issue of shadows and 3D effects which are based on a specific orientation. The list goes on and on.
In my view, if you want to make this work well you'll almost certainly need to write an entire GUI framework from scratch.
Whilst it is clear possible to do this it doesn't seem like a realistic choice when set aside the alternative of making your app work in both portrait and landscape orientations.
You have no chance with fake landscape approach.
There are three solutions for your problem:
Best one - make your application work with any screen size / orientation combination. This is the Windows way.
If your application "must" work in landscape mode, inform users when you detect wrong orientation, that application only functions in landscape mode. Show either message box, or special form with message that cannot be missed, while you hide your other forms, or something like that.
Lock device in landscape mode, like described in How to prevent the screen from automatically rotating on a tablet? But you should know that this is not the way Windows are meant to be used in Desktop mode.
The VCL was not built for this, so I dont really see that happening without major work done to the presentation layer of the RTL.
The have been skinning engines that were capable of this, but they essentially patched the RTL and took over rendering. Rotation data was held in a lookup table for each control that you had to set separately from the actual class.
If Delphi had support for partial classes like Smart Pascal does, then perhaps (if the architecture allowed it) this could be postfixed. But as of writing the VCL is simply not made for this. I am writing a tweening library as I type this, so I have looked into this.
One way that might work for you would be to use the PaintTo method of various controls. Have them paint their fully drawn image onto a bitmap and then rotate the bitmap by 90 degrees to get the portrait versus landscape effect. Then draw that image on the canvas of your form in its OnPaint method (you would want to make the actual controls invisible when in the portrait mode, showing only your painted and rotated bitmaps.)
There are some controls (like TRichEdit) whose PaintTo Method doesn't work correctly, though. So this may be of limited use for you. Another way is to grab a screen capture of the entire client area of the form on the desktop and then rotate and display that. that works even with TRichEdit...

iOS equivalent to layered div's in HTML/CSS

I'm porting a PhoneGap application to native iOS targeting iOS 7. One of the elements is a rectangular <div> with another <div> layered on top that has a variable height and produces a meter effect. The best visual I can think of is a thermometer.
Is there a recommended UI element that would simulate this in iOS?
UIView is the closest thing to a general div in HTML. If you override its drawRect: method, you can perform whatever drawing code you'd like using NSGraphicsContext (including just painting the background a certain color). If you want something more elaborate, you can use a UIImageView and display an image for the various parts of your control.
Cocoapods.org has a lot of great reusable iOS components. One that sounds like it may meet your needs is MSSimpleGauge:
https://github.com/sabymike/MSSimpleGauge

How to make scrollbars wider/bigger for delphi, (including the scrollbar's arrows)

For accessibility purposes, I need to make the scrollbars for all scrollable controls (lists, list views) wider and the scrollbar arrows bigger.
How to get the scrollbars (handles) from a scrollable control (ex: TListView) ?
How to make the scrollbar and the arrows wider/bigger ?
10x for any hints and code...
Accessibility is something that does not concern a single application, but the whole system. That's why there is no API defined to adjust things like border widths, scrollbar size and similar properties of the native controls only for your program. You can however adjust these settings globally in Windows, either by using the Accessibility Wizard, or by adjusting fonts, colours, border sizes and scrollbar sizes in the Display Properties applet.
For more information you should check out the Microsoft Accessibility page and follow the various links.
Edit: Changing the global settings (as the accepted answer suggests) for the benefit of your own program is rude in the extreme. Please keep in mind that this interferes with all other running programs. It is maybe excusable for a system with a touch screen, where controls need to be large to be usable at all - but on such a system the control sizes would probably already be set correctly.
I'm not sure that you can - You have to change it (and restore back) for whole Windows.
http://www.greatis.com/delphicb/tips/lib/system-captionfont.html
Setting and reading property TNonClientMetrics.iScrollWidth
Edit: I know that this solution is rude, but in common cases is the best that you CAN do. If you have specialized TabletPC application then you usually use only that application at one time, not others. But - almost all Windows applications are not designed to work with so big scroolbars. So when you need to use OS dialogs and other applications then you have to switch it back.
There is no better solution than "while is my touchscreen application running set Window scroolbars big, then return it back". We have exactly this application in real world so I know what I'm talking about.
Of course you can write your own grid control (if you have so much time) or use some thirdparty controls (if you have money and time), but that was not question.

Resources