[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Scrollable textedit objects



> Where can I find information about those?

I habe only this. This is the code how an program install scrollable textedit
objects.

-------------------------------cut-------------------------------
typedef struct _xted /* Scrollable textedit objects */
{
	char  *xte_ptmplt;
	char  *xte_pvalid;
	WORD  xte_vislen;
	WORD  xte_scroll;
} XTED;


/****************************************************************
*
* Makes an F(BOX)TEXT object scrollable when MagiC is running
*
* If <is_scroll> is FALSE, then the text field will only be 
* converted to a user character-string.
*
* In the RCS the text field should be left empty, the mask and 
* the validation character-string must, however, be input as the
* RCS otherwise goes on strike.
* For scrolling fields a new mask has to be created, the one 
* installed in the .RSC file can not be used because it is too short.
* The mask created here consists only of '_' characters, because this 
* covers 99.9% of all application cases for scrolling objects. 
* The length of the validation character-string is of no importance, 
* i.e. it must be at least 1, because the AES automatically replicates 
* the last character of the validation string until it reaches the 
* length of the text field.
*
* The maximum length for the input character-string is in each 
* case (TEDINFO.te_txtlen - 1).
*
****************************************************************/

void init_scrlted(OBJECT *o, WORD is_scroll, XTED *xted,
				char *txt, char *tmplt, WORD len)
{
	TEDINFO *t;

	t = o->ob_spec.tedinfo;
	t->te_just = TE_LEFT;		      /* Important! */
	t->te_ptext = txt;
	if	(is_scroll)
		{
		memset(tmplt, '_', len);	  /* New mask */
		tmplt[len] = '\0';
		xted->xte_ptmplt = tmplt;
		xted->xte_pvalid = t->te_pvalid;
		xted->xte_vislen = t->te_tmplen - 1;
		xted->xte_scroll = 0;
		
		t->te_tmplen = len+1;
		t->te_ptmplt = NULL;
		t->te_pvalid = (void *) xted;
		}
	t->te_txtlen = t->te_tmplen;
}

-------------------------------cut-------------------------------
- With scrollable editable fields, since MagiC 4.50 the cursor is set to 
  the end of the text only when this is completely visible. Otherwise 
  the cursor is placed at the start of the text.
-------------------------------cut-------------------------------

In an old news I found that someone habe problems if the length is higher than
250.

Gerhard