I am currently using the advanced editing tableview as outlined in Monotouch.Dialog that allows a user to delete as well as edit the label of table elements. Is there a way to enrich the tableview to achieve something similar to the screenshot, i.e. change the ordering?
You need to add this two methods to your DialogViewController.Source
public override bool CanMoveRow (UITableView tableView, NSIndexPath indexPath)
{
return true;
}
public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath)
{
tableView.MoveRow(sourceIndexPath,destinationIndexPath);
}
Related
I am working for navigation from Table View to View Controller, when I am clicking row I got exception as System.NullReferenceException has been thrown Object reference not set to an instance of an object
Here is code:
UITableViewController _contact;
public Contactlist(UITableViewController contact)
{
_contact=contact;
}
public override void Row Selected (UITableView tableView, NSIndexPath indexPath)
{
// Error System.NullReferenceException
_contact.NavigationController.PushViewController(new incomingscreen(),true);
}
please help
A ViewController's NavigationController property will be null unless the ViewController is contained within a NavigationController.
window.RootViewController = new UINavigationController(new MyTableViewController());
I am working for navigation from Table View to View Controller, when I am clicking row I got exception as System.NullReferenceException has been thrown Object reference not set to an instance of an object in xamarin.ios
public override void Row Selected (UITableView tableView, NSIndexPath indexPath)
{
// Error System.NullReferenceException
_contact.NavigationController.PushViewController(new incomingscreen(),true);
}
I'm new to and trying to learning JavaFX and FXML. Most of my application logic is in the FXMLController class and the base class is pretty much empty except the basic code that was generated by NetBeans IDE such as below
#Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
I have an element with ID input1 that is of type TextField. How can i access this (or any
other) control by its ID? (keeping in mind that I am in the controller class and not the main class).
I found this question below which is exactly what I'm looking for but that situation is different because they are in the main class where scene is defined. How can i access scene from the controller class and use the code in the question below.
How to find an element with an ID in JavaFX?
This is my first time answering a question on Stack Overflow so please go easy on me.
I am new to JavaFX as well and I too had a problem with this.
This is what if found.
Your TextField in your FXMLDocument.fxml must have a fx:id assigned to it, as in:
<TextField fx:id="input1" layoutX="0.5" layoutX="0.5" />
If you are using the JavaFX SceneBuilder then you can find the fx:id under "Code: TextField" on the right side.
Then in your controller class you can access it but using.
#FXML public TextField input1;
You can use an ArrayList to loop through all of your TextFields.
Here is an example.
#FXML public TextField input1;
#FXML public TextField input2;
#FXML public TextField input3;
#FXML public TextField input4;
#FXML public TextField input5;
#FXML public TextField input6;
#FXML public TextField input7;
#FXML public Button button;
List<TextField> inputs = new ArrayList<TextField>();
public void displayText(ActionEvent event) {
inputs.add(input1);
inputs.add(input2);
inputs.add(input3);
inputs.add(input4);
inputs.add(input5);
inputs.add(input6);
inputs.add(input7);
for (int x = 0; x < 7; x++) {
System.out.println(inputs.get(x).getText());
}
}
There might be a simpler way, but this way works for me.
I have a UITableView and on RowSelected i want to show a loading animation and then load another ViewController:
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
LoadingView LV = new LoadingView();
LV.Show("Loading...");
specScreen = new SpecScreen();
controller.NavigationController.PushViewController(specScreen, true);
LV.Hide();
}
However the loading animation only appears for a split second AFTER the next viewcontroller has loaded.
How do I show the Loading animation and then wait for the next view controller to load and hide it again?
Tanis,
make LoadingView singleton and place LoadingView.Instance.Hide(); to ViewDidAppear in SpecScreen viewcontroller.
I have a tag class which extends UIComponent and UIOutput. In this class I have encodeBegin and encodeEnd which I can use my contextWriter to output any kinda html tag I want too by using writer.startElement("div", myComponent) and so on.
My problem now is that I need to insert for example a instead of using the writer.startElement. I can get this done by doing getChildren().add(HtmlCommandButton button = new HtmlCommandButton()); but when doing it like that I cant seem to output the component where I want them to appear, like I can with write.startElement.
Does anyone have any good solutions in how I can take advantage of richfaces tags, JSF tags and similar in my own taglibrary? In short what I would really want to do is inside my encodeBegin:
writer.startElement("a4j:commandButton", myComponent);
writer.writeAttribite("action", "#{Handler.myAction}", null);
writer.endElement("a4j:commandButton");
Thanks by advance
You cannot use the ResponseWriter as you wish to. Two ways I can think of how to add child controls programmatically are either via the binding attribute (see this answer) or in the place where controls usually get created (in JSPs, that is in the tag class).
There are two ways for JSF components to contain other controls: as children or as named facets. Components always control how they render their facets; if they are to render their children, they must return true for getRendersChildren.
This is untested code, but the sequence goes something like this:
#Override
public boolean getRendersChildren() {
return true;
}
#Override
public void encodeBegin(FacesContext context)
throws IOException {
// should really delegate to a renderer, but this is only demo code
ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", this);
String styleClass = getStyleClass();
writer
.writeAttribute("class", styleClass, "styleClass");
UIComponent headerComponent = getFacet("header");
if (headerComponent != null) {
headerComponent.encodeAll(context);
}
writer.startElement("hr", null);
}
#Override
public void encodeChildren(FacesContext context)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
for (UIComponent kid : getChildren()) {
kid.encodeAll(context);
writer.startElement("br", null);
}
}
#Override
public void encodeEnd(FacesContext context)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.endElement("span");
}
Not really an answer, more of a guess, but maybe you could extend one of the facelets controls?
Alternatively, either use facelets directly - which seems to be exactly what you want really though I've not used it myself. Or you could add UIOutput controls where you want HTML to appear and set the value of each to the HTML you want to appear - this is exactly what f:verbatim does under the hood, or so it seems from looking at the source code :-)