int EditAdd(int cn,int x, int y, int width);

 

Add an edit box of the specified width at the X and Y coordinates specified to the specified container.

 

Return Value

 

Returns an int handle to the edit object.

 

Parameters

 

cn

Specifies the container where the edit box will be added.  Container zero is defined as the screen.

 

x

X coordinate.

 

y

Y coordinate.

 

width

Width of the edit box.

 

Remarks

 

The EditAdd() function adds an edit box at the specified x, y coordinates using the specified width to the specified container. Editable text is black text and typically presented in a white box. Use an image to present a form with white boxes and then use EditAdd() to position editable text inside the white boxes of your form. EditAdd() does not draw a border, you do this by displaying an image that looks like a form.

 

See the Sample called EditForm in the SDK folder under Samples.

 

See EditSetLabel() as a great way to save space providing the description of the Edit field. The label is gray text that says something like Email and is overwritten when the user enters their email.

 

Availability

 

Available in DragonFireSDK 2.0 and later.

 

Example

 

#include "DragonFireSDK.h"

#include <string.h>

 

int edit;

 

int OnEditDone()

{

  char EditText[100];

 

   EditGetText(edit, EditText);

 

  if (strcmp(EditText, "foo") == 0)

   {

       EditSetText(edit, "bar");

   }

 

  if (strcmp(EditText, "bye") == 0)

   {

       EditSetVisible(edit, 0);

   }

 

  return(0);

}

 

void AppMain()

{

   ViewAdd("MyForm.png",0,0); // display a form background with white edit boxes

   edit = EditAdd(10, 80, 50);

   EditSetLabel(edit, "Email");

   EditSetOnDone(OnEditDone);

}

 

void AppExit()

{

 

}

 

void OnTimer()

{

 

}