Monotouch.Dialog EntryElement label above input - xamarin.ios

I'm using Monotouch.Dialog and specifically want to have the label above the input in the cell.
Is there a way to do this without needing to roll my own?

There's JVFloatLabeledTextField ported to Xamarin.iOS by gshackles which supports Monotouch.Dialog through the JVFloatLabeledEntryElement class.

Related

Custom Controls in Xamarin iOS with MVVMCross and no XIB

I am following a code only approach for my Xamarin iOS app and can see how you can easily create control such as UILabel and UITextField in ViewDidLoad of a Controller. That is also where I can apply MVVMCross Fluent Binding.
I have seen Stuart's n19 where he creates a custom Circle View and one that creates a Custom Label.
The custom circle overrides the Draw method and draws a circle (Owner Draw)
The custom labels changes the Forecolor of the existing Label (Subclassed)
I don't feel that either of those works for me. I want to create a UIView that is made up of other controls, a composite control. Imagine a control that looked something like this. That would be an ImageView, and 4 labels with one of them clickable.
At what point in the life of the UIView would I create something like that. Is there an equivalent of ViewDidLoad?
As Stuart said in his comment, N=32 - ViewModels and MvxView on the iPad - N+1 days of MvvmCross
is the MVVMCross tutorial you want.
For those that are happy with the idea of ViewModels being more than just a ViewModel per screen and understand Binding the bit around Custom Views starts at minute 20

prompttext in textfield of javafx 2 hides on focus after some java 7 update

i've been making simple javafx 2 gui application and found that prompttext in textfield of javafx 2 hides as soon as the textfield gets focus.
this wasn't this way some updates back.
prior to this update, the textfield showed the prompttext until some text is typed into.
this isn't good and really need a workaround for this.
I just solved this same issue by applying particular CSS rules to text inputs. Here's what I used (which should apply to all text-inputs)
.text-input, .text-input:focused { -fx-prompt-text-fill:darkgray; }
Erem Boto's answer is just fine and should solve your problem!
Please see my answer here to see how to solve the problem if you use proper Java code (no FXML and CSS file).
(And also how to get the other behavior back).
In short, this is the solution:
In case your application interface is written using proper Java code.
Java Code:
textField.setStyle("-fx-prompt-text-fill: derive(-fx-control-inner-background, -30%);");
Where textField is your TextField component.
And in case your application interface is written using FXML and CSS, add the following to your CSS file.
JavaFX FXML (CSS):
.text-input, .text-input:focused {
-fx-prompt-text-fill: derive(-fx-control-inner-background, -30%);
}

extend class in Java FX?

In many occasions JavaFX needs to be customized with classes that extend existing ones. I tried this approach, for example to add a method to the NumberAxis class that would enable the label of the axis to be rotated.
But I got a "NumberAxis is declared final, can't be extended" compiler error. I wonder how people who extend classes do? Do they have access to the source code of javafx, modify it to make some classes not final, and recompile it? (sounds tricky! )
Making lots of classes final in the JavaFX framework was an intentional decision by the framework developers. To get a flavor of why it's done, see the Making Color Final proposal. That's just an example, there are other reasons. I think experience with subclassing in the Swing framework was that it caused errors and maintenance issues that the JavaFX designers wanted to avoid, so many things are made final.
There are other way to extend functionality than to directly subclass. Some alternatives for your rotation example:
aggregation: include the NumberAxis as a member of new class (e.g. NumberAxisWithRotatableText) which adds an accessor to get the underlying NumberAxis node and a method to perform the rotation (e.g. via a lookup as explained below).
composition: for example extend Pane, add a NumberAxis, disable the standard text drawing on the axis and add rotated labels yourself as needed.
css stylesheet: for example use a selector to lookup the text in the NumberAxis and the -fx-rotate attribute to rotate it.
node lookup: Use a node.lookup to get at the underlying text node, and apply the rotation via an API.
skin: All controls have a skin class attached them, replace the default skin class with a custom one.
subclass an alternate class: Subclass the abstract ValueAxis class rather than the final NumberAxis class.
Source code for JavaFX is available with build instructions. However, I don't recommend hacking a personal copy of the source code to remove final constructs unless you also submit it as an accepted patch to the JavaFX system so that you can be sure that your app won't break on a standard JavaFX install.
If you really think it is a good idea for a given class to be subclassable, then log a change request. Sometimes the JavaFX developers are overzealous and make stuff final which would be better not being final. NumberAxis perhaps falls into that category.

A Dialogue with a Custom Layout

I would like to create a dialogue with a custom layout. The Android API documents suggest that I always use Alert Dialogue, and that I do not try to instantiate the Dialogue class directly.
This is extremely difficult, because the builder for AlertDialog does not allow custom views. I was lucky enough to find support for an adapter, but it is still extremely difficult to gain access to a layout inflater.
Is there a reason why a fragment class does not have getContext()?
How do you get a layoutInflater inside a fragment when the savedInstanceState is null?
If it is possible, what is the best way to create a fully custom dialog?
Even though the dialogue fragment does not support...
getLayoutInflater(Bundle) (because the SavedInstanceState is null), or
getContext()
you can use getActivity().getLayoutInflater().

Suggestions for a Monotouch model dialog (accessible from UITable) with text input

I'm looking for a configurable modal dialog to popup over the top when a cell is clicked in a UITableView with various actions, some of which require input, some don't. Is Monotouch.dialog appropriate or is there a better way to achieve this?
The behaviour I'm looking for with the dialog (activated in the UITable) is the following:
- Fixed actions. Click a button, do something.
- Text input. Enter text (for example, reset a password), do something.
Alternatively, is it possible to use a custom controller such as QuickDialog https://github.com/escoz/QuickDialog?
Sincerely,
Adam
Popover for user-input is quite a common task. I would recommend UIPopoverController with custom views inside that when presented allow the user to complete an action / task / input. Quick dialog is a rendition of MonoTouch.Dialog ported to obj-C. You can use straight-up MonoTouch.Dialog if you like: https://github.com/migueldeicaza/MonoTouch.Dialog
I would also recommend my managed C# implementation of UIPopover for MonoTouch here (with video): https://github.com/anujb/Devnos.Popover
Video: http://screencast.com/t/lGwsvtEot9V

Resources