TheSwamp

Code Red => .NET => Topic started by: sdunn on October 15, 2014, 05:50:12 PM

Title: Resume GetEntity after Keword and form
Post by: sdunn on October 15, 2014, 05:50:12 PM
I have a GetEntity prompt that I want to add a settings option to as a keyword.  I have not found a way to return to the GetEntity after exiting the form. 

I found a way that might work using a handler for keywordinput by Gile, but I want to make sure there isn't something obvious that I am overlooking.

http://www.theswamp.org/index.php?topic=31864.msg500800#msg500800 (http://www.theswamp.org/index.php?topic=31864.msg500800#msg500800)
Title: Re: Resume GetEntity after Keword and form
Post by: Jeff_M on October 15, 2014, 06:34:45 PM
The keywordinput handler is for use with SelectionSets. Use a loop to handle the keyword option with the Getxxxx() methods. A quick example:
Code - C#: [Select]
  1.             PromptEntityResult entResult;
  2.             //loop to allow user to pick multiple objects and/or enter a keywordht
  3.             do
  4.             {
  5.                 entResult = ed.GetEntity(entProps);
  6.                 if (entResult.Status == PromptStatus.Keyword)
  7.                 {
  8.                     if (entResult.StringResult != "SEttings") //in this case I have 1 keyword
  9.                         continue;
  10.                     changeSettings();
  11.                 }
  12.                 else if (entResult.Status == PromptStatus.OK)
  13.                 {
  14.                     using (Transaction tr = db.TransactionManager.StartTransaction())
  15.                     {
  16.                          //do what you need with the entity
  17.                     }
  18.                 }
  19.             } while (entResult.Status == PromptStatus.OK || entResult.Status == PromptStatus.Keyword);  //loops until nothing selected or entered
  20.  
Title: Re: Resume GetEntity after Keword and form
Post by: sdunn on October 15, 2014, 06:44:31 PM
Thank you Jeff!