Esempio n. 1
0
 //notify item to listener and hide this form
 private void listView1_Click(object sender, System.EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         int        iSelectedRow = this.listView1.SelectedIndices[0];
         DataRow    selectedRow  = this.table.Rows[iSelectedRow];
         ComboEvent cbe          = new ComboEvent(selectedRow, iSelectedRow, EventType.SELECTED);
         if (this.SelectedItemHandler != null)
         {
             this.SelectedItemHandler(sender, cbe);
         }
     }
     this.Hide();
     this.SelectedItemHandler(sender, new ComboEvent(null, -1, EventType.FORM_HIDED));
 }
Esempio n. 2
0
 /** if key is enter key or ESC key will hide this form
  *  if arrow key (up-down) focus row in listview and notify item to listener **/
 private void listView1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         //Debug by Mr.Fuangwith Sopharath @ 05/06/2006
         //DataRow selectedRow = this.table.Rows[this.listView1.SelectedIndices[0]];
         int     iSelectedRow = getRowIndex(e.KeyData);
         DataRow selectedRow  = null;
         if (0 <= iSelectedRow && iSelectedRow < this.table.Rows.Count)
         {
             selectedRow = this.table.Rows[getRowIndex(e.KeyData)];
         }
         ComboEvent cbe = new ComboEvent(selectedRow, iSelectedRow, EventType.SELECTED);
         if (this.SelectedItemHandler != null)
         {
             this.SelectedItemHandler(sender, cbe);
         }
     }
     if (Keys.Enter == e.KeyData || Keys.Escape == e.KeyData || Keys.F4 == e.KeyData)
     {
         this.Hide();
         this.SelectedItemHandler(sender, new ComboEvent(null, -1, EventType.FORM_HIDED));
     }
 }