Katalogerna
PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 10800


Catching events in inplace edit boxes Please note that this article refers to the GTP.NET
Jump to article- 2007-01-12 09:10:00 - Email plexityHide

Question

I need to know how to fill a combotext (editbox) in the grid (possible without an event ?) and after i need to know how to get a value from that combotextbox after I have selected one item from it by mouse.

Today I only can fill the box with that grid1_OnBeforeEditCell event and I only can retrieve a box value after i have selected one by mouse and additionaly pressed enter.

Answer

You will need to use the event, but you can also hook up event listeners in this event on your combobox. This way you can react to any action taken in the inplace edit box:


private void grid1_OnBeforeEditCell(PlexityHide.GTP.Grid grid, PlexityHide.GTP.BeforeEditEventArgs beforeEdit)
{
  if (beforeEdit.Cell.Content is ComboText)
  {
	(beforeEdit.Cell.Content as ComboText).EditBox.Items.Clear();
	(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 1");
	(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 2");
	(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 3");
	(beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 4");
           (beforeEdit.Cell.Content as ComboText).EditBox.SelectedIndexChanged += new EventHandler(EditBox_SelectedIndexChanged);
  }
  else
  {
     if (beforeEdit.Cell.Content is SingleText)
     {
        (beforeEdit.Cell.Content as SingleText).EditBox.TextChanged += new EventHandler(EditBox_TextChanged);
     }
			
  }		
}

    void EditBox_SelectedIndexChanged(object sender, EventArgs e)
    {
      // Tell someone that the index changed
    }

    void EditBox_TextChanged(object sender, EventArgs e)
    {
      (sender as TextBox).ForeColor=Color.Green;
    }

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...