Method to locate row and column in TableView

In a TableView.setOnMouseClicked ()
How to capture that row and column were clicked?

I am having problem in populating data from a table in one screen to a Text Field in the other screen. I have two classes FirstClass containing a textbox and a button. On pressing a button a second window is opened containing a Table of values. As the user double clicks a row the value of the second column of the row should be inserted into the textbox of the FirstClass. Code of both the classes is attached. Thanking you in anticipation.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class FirstClass extends Application {
public static void main(String[] args) {
     launch(args);
@Override
public void start(final Stage primaryStage) {
     primaryStage.setTitle("First Class");
GridPane gridpane = new GridPane();
          gridpane.setPadding(new Insets(5));
          gridpane.setHgap(5);
          gridpane.setVgap(5);
final TextField userNameFld = new TextField();
gridpane.add(userNameFld, 1, 1);
Button btn = new Button();
btn.setText("Show Table");
gridpane.add(btn, 1, 3);
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
     String a = TableClass.showDialog(primaryStage, true, "Table Window" );
     userNameFld.setText(a);
StackPane root = new StackPane();
Scene scene =new Scene(root, 300, 250);
root.getChildren().addAll(gridpane);
primaryStage.setScene(scene);
primaryStage.show();
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class TableClass extends Stage {
     private static TableClass dialog;
     private static String value = "";
     public static class Person {
private final SimpleStringProperty firstName;
private final SimpleStringProperty lastName;
private Person(String fName, String lName) {
this.firstName = new SimpleStringProperty(fName);
this.lastName = new SimpleStringProperty(lName);
public String getFirstName() {
return firstName.get();
public void setFirstName(String fName) {
firstName.set(fName);
public String getLastName() {
return lastName.get();
public void setLastName(String fName) {
lastName.set(fName);
     private TableView<Person> table = new TableView<Person>();
     private final ObservableList<Person> data =
     FXCollections.observableArrayList(
     new Person("JACK", "BROWN"),
     new Person("JOHN", "VIANNEYS"),
     new Person("MICHAEL", "NELSON"),
     new Person("WILLIAM", " CAREY")
     public TableClass(Stage owner, boolean modality, String title) {
          super();
          initOwner(owner);
          Modality m = modality ? Modality.APPLICATION_MODAL : Modality.NONE;
          initModality(m);
          setOpacity(1);
          setTitle(title);
          StackPane root = new StackPane();
          Scene scene = new Scene(root, 750, 750);
          setScene(scene);
          GridPane gridpane = new GridPane();
          gridpane.setPadding(new Insets(5));
          gridpane.setHgap(5);
          gridpane.setVgap(5);
          TableColumn firstNameCol = new TableColumn("First Name");
     firstNameCol.setMinWidth(100);
     firstNameCol.setCellValueFactory(
     new PropertyValueFactory<Person,String>("firstName")
     TableColumn lastNameCol = new TableColumn("Last Name");
     lastNameCol.setMinWidth(200);
     lastNameCol.setCellValueFactory(
     new PropertyValueFactory<Person,String>("lastName")
     table.setItems(data);
     table.getColumns().addAll(firstNameCol, lastNameCol);
     table.setOnMouseClicked(new EventHandler<MouseEvent>() {
               public void handle(MouseEvent me) {
                    if (me.getClickCount() >= 2) {
               String srr = table.getItems().get(table.getSelectionModel().getSelectedIndex()).getLastName();
               value = srr;
               dialog.hide();
     gridpane.add(table, 1, 5,1,20 );
          root.getChildren().add(gridpane);
     public static String showDialog(Stage stg, Boolean a , String title){
          dialog = new TableClass( stg,a, title);
          dialog.show();
          return value;
}

Similar Messages

  • Retreiving Point location with JTable row and column

    If I have the row and column in a JTable (in a JPanel), how do I get the Point location offset from the location Point of the JTable or JPanel ?

    I think that this may do it.
    Point objPoint = new Point( objTable_.getLocation() );
    int intRow = objTable_.getSelectedRow();
    int intColumn = objTable_.getSelectedColumn();
    int intColumnWidth = objTable_.getColumnModel().getColumn( intColumn ).getWidth();
    int intColumnMargin = objTable_.getColumnModel().getColumnMargin();
    int x = (int) objPoint.getX() + ( (intColumn+1) * intColumnWidth) );
    // perhaps * (intColumnWidth + intColumnMargin)
    int y = (int) objPoint.getY() + ( (intRow+1) * objTable_.getRowHeight());
    // perhaps * (objTable_.getRowHeight() + objTable_.getRowMargin())

  • How do I delete multiple rows and columns in an image?

    I am looking into how digital SLRs extract video data from a CMOS sensor. To give an example, the GH1 from Panasonic can record video at 1920 x 1080 from a 12 MPixel sensor that, say, is 4000 horizontal x 3000 vertical. How they do that seems to be not in the public domain, but there have been a few guesses (see http://www.dvxuser.com/V6/showthread.php?t=206797 and http://luminous-landscape.com/forum/index.php?showtopic=38713).
    One approach would be to simply read every second row of sensor pixels (1500 rows read from the original 3000) and once you have those in memory, delete every second column (2000 columns left). You would end up with a 2000 x 1500 image which could then be resampled to 1920 x 1080.
    I'd like to simulate what the camera appears to be doing, by generating a 4000 x 3000 test image and then asking Photoshop CS4 to delete the appropriate rows and columns. It may not necessarily be every second row; the Canon 5DMk11 appears to read every third row, so I may need to delete two out of every three rows.
    Can Photoshop do that sort of thing? If so, how?

    Thanks for the suggestions. Yes, I did take a detailed look at your images, but they weren't 100% convincing because it wasn't clear just what was happening. And Adobe's explanation, after reading it again, explains nothing at all to someone who doesn't know how Nearest Neighbor works.
    But you are correct -- Nearest Neighbor does effectively delete pixels. I proved it with the attached 6 x 6 image of coloured pixels (the tiny midget image right after this full stop -- you'll have to go to maximum zoom in PS to see it).
    These are the steps to delete every second row and then every second column.
    1. Select Image > Image Size.
    2. Set Pixel Dimensions > Height to half the original (in this case set to 3 pixels).
    3. Set Resample Image to Nearest Neighbor.
    4. Click OK and the image shoould now consist of three vertical white strips and three vertical Green-Red-Blue stripes.
    5. Repeat steps 1-4, but this time set Pixel Dimensions > Width to half the original (in this case set to 3 pixels). The image should now consist of three horizontal stripes Green-Red-Blue.
    Just to make sure the method worked for every third pixel, I repeated the above steps but with 2 pixels instead of 3 and obtained the correct White-Green, White-Green pattern.
    I resampled the Height and Width separately for the test so that I could see what was happening. In a real example, the height and width can be changed at the same time in the one step, achieving the same results as above.
    Finally, how to explain how Nearest Neighbor works in the simple cases described above?
    Division by 2
    In the case of an exact division by two (pixels numbered from top leftmost pixel), only the even numbered rows and columns remain. To put it a different way, every odd numbered row and column are deleted.
    Division by 3
    Only rows and columns 2, 5, 8, 11... remain.
    Division by N
    Only rows and columns 2, 2+N, 2+2N, 2+3N... remain.
    To put it simply, a resample using Nearest Neighbor (using an exact integer multiple) keeps every Nth row and column, starting from number two. The rest are deleted.

  • Keeping row and column headers while scrolling inside a Web Dynpro table

    Hi,
    I have to display a 2x2 matrix with storage location names on the x-axis (i.e. as Column Headers) and material names on the y-axis (i.e. row headers). The table data represents the quantities of a particular material in a particular storage location.
    I am using dynamic UI generation to create this table. It can contain as many as 150 columns and almost as many rows. I dont want a page level scrollbar, and hence, have placed my table inside a scroll container UI element with a fixed height and width.
    I need a way to let the users use the scrollbars inside the scroll container, but still let them see the row  and column headers. Is there a way that I can do this in Dynpro for Java?
    Thanks,
    Navneet Nair.

    Hi Kenn,
    You are probably better off posting this request in this forum User Interface Development in ABAP as you are more likely to get a response.
    Cheers,
    Neil.

  • Goto row and column in a JTextArea

    Does anybody here know the correct procedure to get to a specific row and column in a JTextArea? I want to be able to do something like this:
    replace(char c, int row, int column) - where the original character at row,column will be replaced with c.
    I know that in C++, there is a windows console library that lets u do this, but there isn't one in java so I'm trying to get around it using a JTextArea.
    Thank you.
    Any Help/Comments/Ideas will be greatly appreciated.
    -Patrick

    JTextArea has a replaceRange method.
    John

  • How to set the Selected row and Column in JTable

    Hi,
    i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
    Praveen K Saxena

    Is that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
    myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);

  • How to freeze row and column in JTable

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

  • Setting cursor to appropriate row and column in JTextArea

    Hi
    this is kranthi from Hyd
    iam unable to point out the cursor to the appropriate row and column in the JTextArea
    are there any methods to do so
    plz help me

    Yup, look at setCaretPosition(int pos)

  • Summing the Rows and Columns in an Array

    I am importing a 2-dimensional array of integers.(which is held in a 2-dimensional array)
    I need to store the row sums and column sums in separate 1-dimensional arrays.
    I can get the integers in and print out a list along with the grand total(sum of all).
    But, how do I pass each row's and each column's value in to my sumRow and sumCol methods to get the sum for each row and each column?
    Can I do the row and column summing in the same "for" statement where I calculate the "grand total"? Or am I making this more difficult than it is?
    Would appreciate any help.
    This is what I have so far:
    import java.awt.Graphics;
    import java.applet.Applet;
    public class TwoWayTable extends Applet {
         int numRows;
         int numCols;
         int [] [] cell;
         int [] rowSum;
         int [] colSum;
         int grandTotal;
    public TwoWayTable(int [][] data){
    grandTotal = 0;
    cell = new int [data.length][data.length];
    for(int i = 0; i < data.length; i++)
    for(int j = 0; j < data.length; j++){
         cell[i][j] = data[i][j];
    grandTotal += cell[i][j];
         System.out.println(cell[i][j]);
    System.out.println(grandTotal);
    public int sumRow(int [] data2){
         int rowaccumulator=0;
         rowSum = new int[data2.length];
         for(int numRows = 0; numRows < rowSum.length; numRows++){
         rowaccumulator += rowaccumulator + rowSum[numRows];
              return(rowaccumulator);
    public int sumCol(int [] data3){
         int colaccumulator = 0;
         colSum = new int[data3.length];
         for(int numCols = 0; numCols < colSum.length; numCols++){
              colaccumulator += colaccumulator + colSum[numCols];
              return(colaccumulator);

    Thanks for your input.
    I'll make the changes that you suggest.(after this)
    My output prints:
    4 6 3 8 21
    9 1 5 3 18
    13 7 8 11 39
    numbers are right, but I need to format the table
    the output needs to look like this:
    int int int int | rowsum
    int int int int | rowsum
    colsum colsum colsum colsum | total
    How do I do this?
    I have no idea?
    I'm supposed to call a "void setMargins( )" method to line this up, without
    using the exotic formatting in the IO library.
    I'm also supposed to use "public String toString( )"
    This is what I have so far:
    import java.awt.Graphics;
    import java.applet.Applet;
    public class TwoWayTable extends Applet {
    int numRows;
         int numCols;
         int [] [] cell;
         int [] rowSum;
         int [] colSum;
         int grandTotal;
    public TwoWayTable(int [][] data){
    cell = new int [data.length][data.length];     
    for(int i = 0; i < data.length; i++){
    for(int j = 0; j < data.length; j++){
         cell[i][j] = data[i][j];
    calcTotals(cell);
    for(int i = 0; i < cell.length; ++i){
    for(int j = 0; j < cell.length; ++j){
    System.out.print(cell[i][j] + " ");
    System.out.println(rowSum[i] + " ");
    for(int j = 0; j < cell.length-1; ++j){
    System.out.print(colSum[j] + " ");
    System.out.println(colSum[cell.length-1] + " " + (grandTotal));
         public void calcTotals(int [][] data2){
              grandTotal = 0;
              rowSum = new int[data2.length];                         
              colSum = new int[data2.length];                         
              for(int numRows = 0; numRows < data2.length; numRows++){
              for(int numCols = 0; numCols < data2.length; numCols++){
                   grandTotal += data2[numRows][numCols];               
                   rowSum[numRows] += data2[numRows][numCols];
                   colSum[numCols] += data2[numRows][numCols];

  • Getting row and column of an array element

    Hi,
    I have an array of 24 rows and 24 column giving me a total of 576 elements. How do I get the row and column of a particular element in an array in LabView. E.g. If I have to write to element 127 how do I get the column and row in which element 127 is located.
    Regards,
    Harshil
    Solved!
    Go to Solution.

    Hi Harshil,
    maybe you only need to find the correct "address" of the element in your 2D array?
    Use something like this:
    Maybe you have to switch Row&Column output according to your numbering scheme...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Setting number of rows and columns

    How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
    Then how do I quickly select the last row?
    Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.

    I wish to add a few words to Jerrold responce.
    gjf12 wrote:
    How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
    Then how do I quickly select the last row?
    Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.
    The process that you describe is inefficient.
    The efficient one is :
    create a table
    enter the formulas in a single row
    delete the rows below.
    Now, each newly inserted row will contain the formulas.
    From my point of view, it's when this is done that it will be interesting to apply a script adding rows.
    Here is a script inserting rows.
    --[SCRIPT insertRows]
    Enregistrer le script en tant que Script : insertRows.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une cellule au-dessous de laquelle vous voulez insérer des lignes.
    menu Scripts > Numbers > insertRows
    Le script vous demande le nombre de lignes désiré puit insère celles-ci.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    --=====
    Save the script as a Script: insertRows.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select a cell below which you want to insert rows.
    menu Scripts > Numbers > insertRows
    The script ask you the number of rows to insert then it does the required insertion.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Save this script as a … Script in the "Folder Actions Scripts" folder
    <startupVolume>:Library:Scripts:Folder Action Scripts:
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/01/13
    --=====
    on run
    set defaultValue to 100
    if my parleAnglais() then
    set myInteger to my askAnumber("Insert how many rows ?", defaultValue, "i")
    else
    set myInteger to my askAnumber("Combien de lignes voulez-vous insérer ?", defaultValue, "i")
    end if
    set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    repeat myInteger times
    add row below row rowNum2
    end repeat
    end tell
    end run
    --=====
    on getSelParams()
    local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
    set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
    if r_Name is missing value then
    if my parleAnglais() then
    error "No selected cells"
    else
    error "Il n'y a pas de cellule sélectionnée !"
    end if
    end if
    set two_Names to my decoupe(r_Name, ":")
    set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
    if item 2 of two_Names = item 1 of two_Names then
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    else
    set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
    end if
    return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
    end getSelParams
    --=====
    set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
    apply to named row or named column !
    on decipher(n, d, s, t)
    tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
    end decipher
    --=====
    set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers" to tell document 1
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    try
    (selection range of table y) as text
    on error errMsg number errNum
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    return {theDoc, theSheet, theTable, theRange}
    end try
    end repeat -- y
    end if -- x>0
    end tell -- sheet
    end repeat -- i
    end tell -- document
    return {missing value, missing value, missing value, missing value}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to ""
    return l
    end decoupe
    --=====
    Asks for an entry and checks that it is an floating number
    set myInteger to my askAnumber(Prompt, DefaultValue, "i")
    set myFloating to my askAnumber(Prompt, DefaultValue, "f")
    on askAnumber(lPrompt, lDefault, ForI)
    local lPrompt, lDefault, n
    tell application (path to frontmost application as string)
    if ForI is "f" then
    set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
    try
    set n to n as number (* try to convert the value as an number *)
    return n
    on error
    if my parleAnglais() then
    display alert "The value needs to be a floating number." & return & "Please try again."
    else
    display alert "La valeur saisie doit être un nombre décimal." & return & "Veuillez recommencer."
    end if
    end try
    else
    set n to text returned of (display dialog lPrompt default answer lDefault as text)
    try
    set n to n as integer (* try to convert the value as an integer *)
    return n
    on error
    if my parleAnglais() then
    display alert "The value needs to be an integer." & return & "Please try again."
    else
    display alert "La valeur saisie doit être un nombre entier." & return & "Veuillez recommencer."
    end if
    end try -- 1st attempt
    end if -- ForI…
    end tell -- application
    Here if the first entry was not of the wanted class
    second attempt *)
    tell application (path to frontmost application as string)
    if ForI is "f" then
    set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
    try
    set n to n as number (* try to convert the value as an number *)
    return n
    on error
    end try
    else
    set n to text returned of (display dialog lPrompt default answer lDefault as text)
    try
    set n to n as integer (* try to convert the value as an integer *)
    return n
    on error
    end try -- 1st attempt
    end if -- ForI…
    end tell -- application
    if my parleAnglais() then
    error "The value you entered was not numerical !" & return & "Goodbye !"
    else
    error "La valeur saisie n’est pas numérique !" & return & "Au revoir !"
    end if
    end askAnumber
    --=====
    on parleAnglais()
    local z
    try
    tell application "Numbers" to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) mercredi 13 janvier 2010 12:43:34

  • Rows and columns of rectangles

    I am trying to replicate a portion of a script from an AS book which has tutorials on games.  I have uploaded the files.  I cannot seem to get the SWF to display the rectangles which are called "bricks" in the AS file.  The class is "temp3" . . . doesn't really matter what it's called as long as it's not a reserved variable name I think and as long as no other AS files are calling it in my file directory.  Flash CS4 Pro, AS3.0

    I found out what was wrong with part of my AS file.  I stated "for(var x:unit=0 . . . )"; instead I should have stated "for(var x:uint=0 . . . )".  However now the Compiler Error reads 1180: Call to a possibly undefined method makeBricks.  I am interested in knowing what is the proper way to organize or structure my AS file so that it can read the public function "makeBricks()".  If I remove the package call, the public declaration, and the private declaration and embed the AS code into the first frame of a new FLA file I can get the SWF to display what it is supposed to display--rows and columns of rectangles.  Why can't I get it to work with an external AS file?  Can anyone please help?  Thanks a mil in advance.
    -markerline

  • Rows and Columns

    Dear all,
    Could u plz tell me how to create rows and columns dynamically at runtime?
    I got 3 columns and multiple rows.How do i go about it?
    Is there ne FM to do this?

    Can you create an internal table dynamically? (at run time)
    Yes , you can create a Dynamic Internal table .Just chek out this program .
      type-pools : abap.
      field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
      data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
      selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
      start-of-selection.
        perform get_structure.
      perform create_dynamic_itab.      *********Creates a dyanamic internal table*********
      perform get_data.
      perform write_out.
      form get_structure.
      data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
      data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?= 
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
        loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
      endform.
      form create_dynamic_itab.
    Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc
                   importing
                      ep_table        = dy_table.
        assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
      endform.
      form get_data.
    Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
      endform.
       Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  
             of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    http://www.sap-img.com/ab030.htm

  • Multiple Rows and Columns selection on ALV

    Hi all,
    What is the best solution to allow the multiple selection or combination of selection (rows and columns) on an ALV ?
    I would like to be able to select some rows and some columns and to get the result cells in order to update them.
    Thanks in advance for your help.
    David

    Thanks Srinivas and Seela,
    I forgot to precise that my ALV is dynamic, I used the method 'add_new_child_node'.
    I tried the different possibilties with method attributes but I don't find the good attributes combination to allow columns selection.
    I add also that I have to be able to select several no adjacent columns.
    What do you think about this workaround :
    Is it possible to add a line on my ALV with checkbox between the header line (with column title) and data line.
    I will search using the method add_cell_variant but I don't know if it's possible with dynamic ALV.
    Thanks.
    David

  • Programmactic Access DataGrid Rows and Columns

    Hello,
    I am new to ActionScript. Can you tell me how can I access
    the rows and columns of a data grid?
    What I want to do is that when the application load, I will
    populate the datagrid with the Xml returned from the webservice.
    After that, webservice will be called periodically (using timer)
    and the information in the datagrid needs to be updated. The cells
    which are updated need to be highlighted.
    The datagrid actually contains the stock market data (symbol
    name and its other attributes). So once the datagrid has been
    populated on application creation, it contains all the symbols in
    the market. After that, only attributes of the symbols will change,
    like price, volume etc. What I want is that once the datagrid is
    populated, i can access the row by using the value of symbol code
    and then update the appropriate columns of that symbol. (Xml from
    next time will contain only symbols whose values change from last
    time).
    Below is the code that I have written so far.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="OnAppCreationComplete()" width="100%"
    height="100%">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    private var count:uint = 0;
    private var messageFramXmlList:XMLList;
    private var marketSnapshotTimer:Timer = new Timer(1000);
    private function OnAppCreationComplete() : void
    this.ajaxServiceInvokerProxy.addEventListener(ResultEvent.RESULT,
    this.OnWebServiceResultArrived);
    this.ajaxServiceInvokerProxy.InvokeService.send();
    this.marketSnapshotTimer.addEventListener(TimerEvent.TIMER,
    this.OnSnapshotTimerTick);
    this.marketSnapshotTimer.start();
    private function
    OnWebServiceResultArrived(event:ResultEvent) : void
    var marketSnapshotXml:XML = new XML(event.result);
    this.messageFramXmlList =
    marketSnapshotXml.child("MarketSnapshot").child("MessageFrameList")[0].child("MessageFram e");
    this.dgTopPosts.dataProvider = this.messageFramXmlList;
    this.btnCounter.label = this.count.toString();
    private function OnSnapshotTimerTick(event:TimerEvent) :
    void
    this.count++;
    this.ajaxServiceInvokerProxy.InvokeService.send();
    ]]>
    </mx:Script>
    <mx:WebService id="ajaxServiceInvokerProxy"
    wsdl="
    http://jehanzeb/ajaxserviceinvoker/ajaxserviceinvoker.asmx?wsdl"
    useProxy="false">
    <mx:operation name="InvokeService">
    <mx:request>
    <serviceWithComonentName>DetailedSnapshotComponent.MarketSnapshot@TADAWUL</serviceWithCom onentName>
    <parametersXml><![CDATA[ <Parameters/>
    ]]></parametersXml>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    <mx:Panel x="10" y="10" width="100%" height="100%"
    layout="absolute" title="Market View">
    <mx:RichTextEditor id="txtMarketViewResult" x="10" y="10"
    width="612" height="194" />
    <mx:DataGrid x="10" y="223" id="dgTopPosts" width="100%"
    height="303">
    <mx:columns>
    <mx:DataGridColumn headerText="Symbol Code"
    dataField="SymbolID" />
    <mx:DataGridColumn headerText="Last Time"
    dataField="LastTime" />
    <mx:DataGridColumn headerText="Net Change"
    dataField="NetChange" width="75"
    />
    <mx:DataGridColumn headerText="Percent Change"
    dataField="PercentChange" width="75" />
    <mx:DataGridColumn headerText="Previous Closed"
    dataField="PreviousClosed" width="75"/>
    <mx:DataGridColumn headerText="Close" dataField="Close"
    width="75"/>
    <mx:DataGridColumn headerText="Direction"
    dataField="Direction" width="75"/>
    <mx:DataGridColumn headerText="BidPrice"
    dataField="BidPrice" width="75"/>
    <mx:DataGridColumn headerText="AskPrice"
    dataField="AskPrice" width="75"/>
    <mx:DataGridColumn headerText="BidVolume"
    dataField="BidVolume" width="75"/>
    <mx:DataGridColumn headerText="AskVolume"
    dataField="AskVolume" width="75"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:LinkButton id="btnCounter" x="10" y="528" width="306"
    textAlign="left" label="" />
    </mx:Panel>
    </mx:Application>

    To achieve what you want, I would have two functions:
    * One populates the DataGrid for the first time, i.e. the
    inital load
    * The other does the 'update' on each interval, since there's
    logic required
    To update the DataGrid with only the rows that have changed,
    you're going to have to compare
    the incoming XML to the existing XML in the dataProvider of
    the DataGrid, then selectively update the dataProvider.
    You can use the
    getItemAt() and
    setItemAt() methods of the data provider to check each row
    against the incoming data. So, some example code:
    // This is the function which handles the result of your
    'updated data only' webservice
    private function handleUpdateInvoke (event:ResultEvent) :
    void {
    var incoming:XML = new XML(event.result);
    var someList:XMLList = incoming.somePattern;
    // For each data provider item, check the key and if it
    matches
    // one of the incoming keys, update it at that index
    var numRows = this.dgTopPosts.dataProvider.length;
    var existingDataRow:*
    for (var i:Number = 0; i < numRows; i++) {
    existingDataRow = this.dgTopPosts.dataProvider.getItemAt(i);
    for each (var newDataRow:* in someList) {
    if (existingDataRow.SymbolID == newDataRow.SymbolID) {
    this.dgTopPosts.dataProvider.setItemAt(newDataRow, i);
    }

Maybe you are looking for

  • PDF portfolio view in Adobe reader

    Hi, I recently created a PDF portfolio for a co-worker using Acrobat 9.0 Pro. I used the Grid with File Preview layout and added a header that appears right above the grid. Everything works well except that when my co-worker opens the PDF portfolio i

  • Active Directory domain migration with Exchange 2010, System Center 2012 R2 and File Servers

    Greeting dear colleagues! I got a task to migrate existing Active Directory domain to a new froest and a brand new domain. I have a single domain with Forest/Domain level 2003 and two DC (2008 R2 and 2012 R2). My domain contains Exchange 2010 Organiz

  • C7280 wont print, why?

    I have a c7280 all in one printer that i have had for many years and have never had a problem, but that changed today and i can't figure out what is wrong.  I am hooked up to my wireless router network and can print from my PC and my laptop, and agai

  • Trim optimization in paper mills.

    Dear all, i'm trying to understand the trim optimized model in SNO , Can any one provide me with the used nodes and details of the model. regards. Ahmad

  • XY Buffer for 2 points

    I am trying to plot two counter vales (acquired one point at a time from a DAQ card). Using a single XY-Buffer works well, but I cannot seem to show both counters in a single plot. Can someone tell me how I solve this problem. On the same question, i