home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
pd
/
programming
/
utils
/
dialoglib
/
examples.lha
/
test02.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-09
|
4KB
|
133 lines
#include <exec/nodes.h>
#include <exec/lists.h>
#include <libraries/gadtools.h>
#include <utility/tagitem.h>
#include <proto/exec.h>
#include <proto/gadtools.h>
#include <proto/intuition.h>
#include <proto/utility.h>
#include <dialog/dialog.h>
#include <stdio.h>
struct Screen *myScreen;
APTR myVisualInfo;
VOID dialog( VOID )
{
DialogElement root, vstack, hstack1, hstack, hspring, ok, hstack2, *termination;
DialogElement string1, string2, string3, string4;
UBYTE buffer1[32], buffer2[32], buffer3[32], buffer4[32];
ULONG error = 0;
initDialogElement( &root, NULL, dispatchRoot, &error,
DA_Screen, myScreen,
DA_Member, &vstack,
WA_Activate, TRUE,
WA_DragBar, TRUE,
TAG_DONE );
initDialogElement( &vstack, &root, dispatchVStack, &error,
DA_Member, &hstack1,
DA_Member, &hstack,
DA_Member, &hstack2,
TAG_DONE );
initDialogElement( &hstack, &root, dispatchHStack, &error,
DA_Member, &hspring,
DA_Member, &ok,
DA_Member, &hspring,
TAG_DONE );
initDialogElement( &hspring, &root, dispatchHSpring, &error, TAG_DONE );
initDialogElement( &ok, &root, dispatchButton, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "_Ok",
GT_Underscore, '_',
DA_EquivalentKey, 'O',
DA_Termination, TRUE,
TAG_DONE );
initDialogElement( &hstack1, &root, dispatchHStack, &error,
DA_Member, &string1,
DA_Member, &string4,
TAG_DONE );
initDialogElement( &hstack2, &root, dispatchHStack, &error,
DA_Member, &string3,
DA_Member, &string2,
TAG_DONE );
initDialogElement( &string1, &root, dispatchString, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement left",
/* NGDA_Flags, PLACETEXT_LEFT, *** default *** */
GTST_MaxChars, 31,
DA_Storage, buffer1,
TAG_DONE );
initDialogElement( &string2, &root, dispatchString, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement right",
NGDA_Flags, PLACETEXT_RIGHT,
GTST_MaxChars, 31,
DA_Storage, buffer2,
TAG_DONE );
initDialogElement( &string3, &root, dispatchString, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement above",
NGDA_Flags, PLACETEXT_ABOVE,
GTST_MaxChars, 31,
DA_Storage, buffer3,
TAG_DONE );
initDialogElement( &string4, &root, dispatchString, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement below",
NGDA_Flags, PLACETEXT_BELOW,
GTST_MaxChars, 31,
DA_Storage, buffer4,
TAG_DONE );
if( error )
goto cleanup;
buffer1[0] = buffer2[0] = buffer3[0] = buffer4[0] = '\0';
termination = runSimpleDialog( &root,
WA_Title, "Example : GadTools STRING",
WA_InnerWidth, 300,
WA_InnerHeight, 200,
TAG_DONE );
printf( "buffer contents:\n%s\n%s\n%s\n%s\n", buffer1, buffer2, buffer3, buffer4 );
cleanup:
cleanupDialogElement( &string1 );
cleanupDialogElement( &string2 );
cleanupDialogElement( &string3 );
cleanupDialogElement( &string4 );
cleanupDialogElement( &ok );
cleanupDialogElement( &hstack );
cleanupDialogElement( &hspring );
cleanupDialogElement( &hstack1 );
cleanupDialogElement( &hstack2 );
cleanupDialogElement( &vstack );
cleanupDialogElement( &root );
}
main( int argc, char *argv[] )
{
myScreen = LockPubScreen( NULL );
if( !myScreen )
goto cleanup;
myVisualInfo = GetVisualInfo( myScreen, TAG_DONE );
if( !myVisualInfo )
goto cleanup;
dialog();
cleanup:
if( myVisualInfo )
FreeVisualInfo( myVisualInfo );
if( myScreen )
UnlockPubScreen( NULL, myScreen );
}