PersonSelectWindow.createTable C# (CSharp) Method

createTable() private method

private createTable ( ) : void
return void
    private void createTable()
    {
        LogB.Debug("Persons count" + persons.Count.ToString());
        uint padding = 4;
        uint cols = 4; //each row has 4 columns
        uint rows = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols) ) +1);
        int count = 0;

        label_selected_person_name.Text = "";
        SelectedPerson = null;
        personButtonsSensitive(false);
        vbox_button_delete_confirm.Visible = false;

        for (int row_i = 0; row_i < rows; row_i ++) {
            for (int col_i = 0; col_i < cols; col_i ++)
            {
                if(count >= persons.Count)
                    return;

                Person p = (Person) persons[count ++];

                PersonPhotoButton ppb = new PersonPhotoButton(p);
                Gtk.Button b = ppb.CreateButton();
                b.Show();

                b.Clicked += new EventHandler(on_button_portrait_clicked);
                b.CanFocus=true;

                table1.Attach (b, (uint) col_i, (uint) col_i +1, (uint) row_i, (uint) row_i +1,
                        Gtk.AttachOptions.Fill,
                        Gtk.AttachOptions.Fill,
                        padding, padding);

            }
        }

        table1.ShowAll();
    }

Usage Example

Example #1
0
    static public PersonSelectWindow Show(Gtk.Window parent, ArrayList persons)
    {
        if (PersonSelectWindowBox == null)
        {
            PersonSelectWindowBox = new PersonSelectWindow(parent);
        }

        PersonSelectWindowBox.persons = persons;

        PersonSelectWindowBox.createTable();

        PersonSelectWindowBox.person_select_window.Show();

        return(PersonSelectWindowBox);
    }
All Usage Examples Of PersonSelectWindow::createTable