GetSys

ReadModal

Edit a list of Get objects

Syntax

Signature
xBool ReadModal( Get *getList[], int count, int pos, TopBarMenu *menu, int msgRow, int msgLeft, int msgRight, const char *msgColor );

Arguments

getList, count the Gets of the READ.

pos the Get to start with, from 1; 0 or NIL starts with the first one.

menu the top bar menu of the READ, or NULL for none.

msgRow, msgLeft, msgRight the message row; NIL shows no messages.

msgColor the color of the message row, or NULL for the current color.

Return value

T when a variable was changed.

Description

Include xdev-wtui-classes.h. ReadModal() reads one Get after another with its reader, GetReader() by default, until the last Get is left with Enter, or PgUp, PgDn, Ctrl+W or Esc is pressed. While a Get is active, its message is shown in the middle of the message row; the row is restored at the end. With a top bar `menu`, the menu runs from the Gets: see GetApplyKey(). The Gets stay owned by the program: draw them with GetDisplay() before the READ and release them with GetFree() after it.

The scoreboard on row 0 from column 60 shows "Ins", "Invalid Date" and "Range" when Set( _SET_SCOREBOARD ) is on.

Example

readmodal.c
#include "xdev-wtui.h"
#include "xdev-wtui-classes.h"

int main( void )
{
   char           name[ 21 ] = "";
   double         amount = 0;
   const GetOpts  nameOpts = { .picture = "@!", .caption = "&Name:", .message = "The name in upper case" };
   const GetOpts  amountOpts = { .picture = "99,999.99", .caption = "&Amount:", .message = "The amount" };
   Get           *getList[ 2 ];

   Scroll( 0, 0, MaxRow(), MaxCol(), 0, 0 );
   getList[ 0 ] = GetNewC( 2, 12, name, sizeof( name ), "name", &nameOpts );
   getList[ 1 ] = GetNewN( 4, 12, &amount, "amount", &amountOpts );
   for( int i = 0; i < 2; ++i )
      GetDisplay( getList[ i ] );

   if( ReadModal( getList, 2, 0, NULL, MaxRow(), 0, MaxCol(), NULL ) )
   {
      DevPos( 6, 0 );
      DevOut( name, NULL );
   }

   for( int i = 0; i < 2; ++i )
      GetFree( getList[ i ] );

   return 0;
}

See also