Implements all common dialogs including: inputDialog(), fileDialog(), directoryDialog(), Messagebox()
![]()
#include "Fab3000.h"
int main ()
{
char sCaption[100] = "Sample Input dialog...";
char sLabel[100] = "Enter Your Name:";
char sYourName[100], buffer[200], sPatternList[100], sFile[250];
int nResult = inputDialog( sCaption, sLabel, sYourName );
if( nResult )
{
sprintf( buffer, "Let me guess, your name is: %s", sYourName );
princ( buffer );
}
else
{
princ( "User Cancelled - No Name was given." );
}
//Select Gerber File
strcpy( sCaption, "Select Gerber file..." );
strcpy( sPatternList, "Gerber File (*.gbr,*.gbx,*.ger,*.pho,*.x)\nAll Files (*)" );
nResult = fileDialog( sCaption, sPatternList, sFile );
if( nResult )
{
sprintf( buffer, "File Selected: %s", sFile );
princ( buffer );
}
else
{
sprintf( buffer, "%s Cancelled - No File Selected.", sYourName );
princ( buffer );
}
//Select Folder
strcpy( sCaption, "Select Export Folder..." );
nResult = directoryDialog( sCaption, sFile );
if( nResult )
{
sprintf( buffer, "Folder Selected: %s", sFile );
princ( buffer );
}
else
{
sprintf( buffer, "%s Cancelled - No Folder Selected.", sYourName );
princ( buffer );
}
//Message Box
strcpy( sCaption, "Sample Question MessageBox..." );
strcpy( sLabel, "This script is almost finished.\n\nDo you wish to continue?" );
//If 0 is returned No was selected
//If 1 is returned Yes was selected.
nResult = messageBox( sCaption, sLabel, dbcMessageBoxQuestion );
if( nResult )
{
sprintf( buffer, "Great! %s wants to continue.", sYourName );
princ( buffer );
}
else
{
sprintf( buffer, "%s has Cancelled - Exiting script.", sYourName );
princ( buffer );
return 0;
}
//Message Box
sprintf( buffer, "Hi %s ...", sYourName );
strcpy( sCaption, buffer );
strcpy( sLabel, "This is a warning messagebox to let you know\nthat this script has completed.\n\nPress OK to finish." );
messageBox( sCaption, sLabel, dbcMessageBoxWarning );
//Final Message
sprintf( buffer, "\n%s, thank you for completing this script.\nIf you have any questions please visit our website\nwww.NumericalInnovations.com", sYourName );
princ( buffer );
return 0;
}