home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
GPF.ZIP
/
SAMPLE.SRC
/
SOURCES.ZIP
/
SAMPLE1.SQC
< prev
Wrap
Text File
|
1991-04-02
|
133KB
|
3,280 lines
/******** Sample1 C Program Source Code File (.Sqc) ********/
/* */
/* PROGRAM NAME: Sample1 Application (Sample) */
/* ------------- */
/* Generated by GPF (Gui Programming Facility) */
/* */
/* DATABASE NAME: SAMPLE */
/* ------------- */
/* */
/* DATE AND TIME: Tue Apr 02 17:42:44 1991 */
/* */
/* Presentation Manager */
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright Jean Bernard CLERIN */
/* */
/* REVISION LEVEL: 1.1 */
/* --------------- */
/* */
/* WHAT YOU NEED TO COMPILE THIS PROGRAM: */
/* -------------------------------------- */
/* */
/* REQUIRED FILES: */
/* --------------- */
/* */
/* Sample1.C - Source code */
/* Sample.Cmd - Command file to build this program */
/* Sample.Mak - Make file for this program */
/* Sample.Def - Module definition file */
/* Sample.Ext - External definition file */
/* Sample.Ids - Pm header file */
/* Sample.L - Linker automatic response file */
/* Sample.Rc - Resource file */
/* */
/* OS2.H - Presentation Manager include file */
/* STDLIB.H - Miscellaneous function declarations */
/* STDIO.H - Declarations for standard I/O routines */
/* STRING.H - String function declarations */
/* MEMORY.H - Declarations for buffer (memory) manipulation */
/* MALLOC.H - Definitions for memory allocation functions */
/* PROCESS.H - Definitions for process control functions */
/* */
/* REQUIRED LIBRARIES: */
/* ------------------- */
/* */
/* OS2.LIB - Presentation Manager/OS2 library */
/* LLIBCMT.LIB - Protect mode/standard combined large model C */
/* library multi-threaded. */
/* */
/* REQUIRED PROGRAMS: */
/* ------------------ */
/* */
/* IBM C Compiler */
/* IBM Linker */
/* Resource Compiler */
/* */
/**********************************************************************/
/**********************************************************************/
/* */
/* Include relevant sections of the PM header file. */
/* */
/**********************************************************************/
/*====================================================================*/
/* */
/* #define: To include: */
/* */
/* + INCL_WINWINDOWMGR General window management */
/* + INCL_WINMESSAGEMGR Message management */
/* + INCL_WININPUT Mouse and keyboard input */
/* + INCL_WINDIALOGS Dialog boxes */
/* + INCL_WINSTATICS Static controls */
/* + INCL_WINBUTTONS Button controls */
/* + INCL_WINENTRYFIELDS Entry Fields */
/* INCL_WINMLE Multiple Line Entry Fields */
/* + INCL_WINLISTBOXES List box controls */
/* + INCL_WINMENUS Menu controls */
/* + INCL_WINSCROLLBARS Scroll bar controls */
/* + INCL_WINFRAMEMGR Frame manager */
/* INCL_WINFRAMECTLS Frame controls (title bars & size border)*/
/* INCL_WINRECTANGLES Rectangle routines */
/* INCL_WINSYS System values (and colors) */
/* INCL_WINTIMER Timer routines */
/* + INCL_WINACCELERATORS Keyboard accelerators */
/* INCL_WINTRACKRECT WinTrackRect() function */
/* INCL_WINCLIPBOARD Clipboard manager */
/* + INCL_WINCURSORS Text cursors */
/* + INCL_WINPOINTERS Mouse pointers */
/* INCL_WINHOOKS Hook manager */
/* + INCL_WINSWITCHLIST Shell Switch List API */
/* INCL_WINPROGRAMLIST Shell Program List API */
/* INCL_WINSHELLDATA Shell Data (?) */
/* INCL_WINCOUNTRY Country support */
/* INCL_WINHEAP Heap Manager */
/* INCL_WINATOM Atom Manager */
/* INCL_WINCATCHTHROW WinCatch/WinThrow support */
/* INCL_WINERRORS Error code definitions */
/* INCL_NLS DBCS window manager definition */
/* + INCL_WINHELP Help Manager definitions */
/* INCL_WINSEI Set Error Info API */
/* INCL_WINLOAD Load/Delete Library/Procedure */
/* INCL_WINTYPES Definitions for Datatypes */
/* */
/* ===================================================================*/
/* */
/* INCL_GPI Include all of the GPI */
/* INCL_GPICONTROL Basic PS control */
/* INCL_GPICORRELATION Picking, Boundary and Correlation */
/* INCL_GPISEGMENTS Segment Control and Drawing */
/* INCL_GPISEGEDITING Segment Editing via Elements */
/* INCL_GPITRANSFORMS Transform and Transform Conversion */
/* INCL_GPIPATHS Paths and Clipping with Paths */
/* INCL_GPILOGCOLORTABLE Logical Color Tables */
/* INCL_GPIPRIMITIVES Drawing Primitives and Primitive Attributes*/
/* INCL_GPILCIDS Phyical and Logical Fonts with Lcids */
/* INCL_GPIBITMAPS Bitmaps and Pel Operations */
/* INCL_GPIREGIONS Regions and Clipping with Regions */
/* INCL_GPIMETAFILES Metafiles */
/* INCL_GPIDEFAULTS Default Primitive Attributes */
/* INCL_GPIERRORS defined if INCL_ERRORS defined */
/* */
/**********************************************************************/
#define INCL_DOS /* Need DOS support */
#define INCL_DOSERRORS
#define INCL_WINWINDOWMGR /* General window management */
#define INCL_WINMESSAGEMGR /* Message management */
#define INCL_WININPUT /* Mouse and keyboard input */
#define INCL_WINDIALOGS /* Dialog boxes */
#define INCL_WINSTATICS /* Static controls */
#define INCL_WINBUTTONS /* Button controls */
#define INCL_WINENTRYFIELDS /* Entry Fields */
#define INCL_WINMLE /* Multiple Line Entry Fields */
#define INCL_WINLISTBOXES /* List box controls */
#define INCL_WINMENUS /* Menu controls */
#define INCL_WINSCROLLBARS /* Scroll bar controls */
#define INCL_WINFRAMEMGR /* Frame manager */
#define INCL_WINRECTANGLES /* Rectangle routines */
#define INCL_WINSYS /* System values (and colors) */
#define INCL_WINACCELERATORS /* Keyboard accelerators */
#define INCL_WINCLIPBOARD /* Clipboard manager */
#define INCL_WINCURSORS /* Text cursors */
#define INCL_WINPOINTERS /* Mouse pointers */
#define INCL_WINSWITCHLIST /* Shell Switch List API */
#define INCL_WINPROGRAMLIST /* Shell Program List API */
#define INCL_WINSHELLDATA /* Shell Data (?) */
#define INCL_WINERRORS /* Error code definitions */
#define INCL_WINHELP /* Help Manager definitions */
#define INCL_WINHEAP /* Heap Manager */
#define INCL_WINTIMER /* Timer routines */
#define INCL_GPIPRIMITIVES /* Drawing Primitives and Attributes*/
#define INCL_GPILCIDS /* Phyical and Logical Fonts Lcids */
#include <os2.h> /* Presentation Manager include file */
/**********************************************************************/
/* */
/* Include C library routine header files */
/* */
/**********************************************************************/
#include <stdlib.h> /* Miscellaneous function declarations */
#include <stdio.h> /* Declarations for standard I/O routines */
#include <string.h> /* String function declarations */
#include <memory.h> /* Declarations for memory manipulation */
#include <malloc.h> /* Definitions for memory allocation */
#include <process.h> /* Definitions for process control functions */
/**********************************************************************/
/* */
/* Include Sql library routine header files */
/* */
/**********************************************************************/
#include <sqlenv.h>
#include <sql.h>
#include <sqlca.h>
/**********************************************************************/
/* */
/* Define GPFPARMS (Gpf Parameters) */
/* */
/**********************************************************************/
#include "GpfParms.h" /* Definitions for GpfParms */
/**********************************************************************/
/* */
/* Miscellaneous constants */
/* */
/**********************************************************************/
#define EXTRAWORDS (4 * sizeof(PVOID)) /* Extra window words */
#define GPF_PMC_LEVEL 1 /* GpfPmc.lib Level */
#define COMMAND 0 /* Process commands received from the user */
#define EXTERN extern
#define STACKSIZE (1024*8)
/**********************************************************************/
/* */
/* Miscellaneous constants Ids */
/* */
/**********************************************************************/
#include "Sample.Ids"
/**********************************************************************/
/* */
/* Function prototypes for private C functions */
/* */
/**********************************************************************/
#include "Sample.Ext"
/**********************************************************************/
/* */
/* STATIC Function prototypes for private C functions */
/* */
/**********************************************************************/
static VOID ActionAboutOk( PGPFPARMS pGpfParms );
static VOID WmInitWndAboutWindow( PGPFPARMS pGpfParms );
static VOID WmActiveAboutWindow( PGPFPARMS pGpfParms );
static VOID WmDeActiveAboutWindow( PGPFPARMS pGpfParms );
static VOID WmCreateAboutWindow( PGPFPARMS pGpfParms );
static VOID WmDestroyAboutWindow( PGPFPARMS pGpfParms );
static VOID WmPaintAboutWindow( PGPFPARMS pGpfParms );
static VOID WmShowAboutWindow( PGPFPARMS pGpfParms );
static VOID WmHideAboutWindow( PGPFPARMS pGpfParms );
static VOID CommandAboutWindow( PGPFPARMS pGpfParms );
static VOID ActionOk( PGPFPARMS pGpfParms );
static VOID WmInitWndDialogStaff( PGPFPARMS pGpfParms );
static VOID WmActiveDialogStaff( PGPFPARMS pGpfParms );
static VOID WmDeActiveDialogStaff( PGPFPARMS pGpfParms );
static VOID WmCreateDialogStaff( PGPFPARMS pGpfParms );
static VOID WmDestroyDialogStaff( PGPFPARMS pGpfParms );
static VOID WmPaintDialogStaff( PGPFPARMS pGpfParms );
static VOID WmShowDialogStaff( PGPFPARMS pGpfParms );
static VOID WmHideDialogStaff( PGPFPARMS pGpfParms );
static VOID CommandDialogStaff( PGPFPARMS pGpfParms );
static VOID ActionListBoxOrg( PGPFPARMS pGpfParms );
static VOID ActionShowOrg( PGPFPARMS pGpfParms );
static VOID ActionCancel1( PGPFPARMS pGpfParms );
static VOID ActionButtonHelp1( PGPFPARMS pGpfParms );
static VOID WmInitWndListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmActiveListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmDeActiveListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmCreateListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmDestroyListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmPaintListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmShowListOrgWindow( PGPFPARMS pGpfParms );
static VOID WmHideListOrgWindow( PGPFPARMS pGpfParms );
static VOID CommandListOrgWindow( PGPFPARMS pGpfParms );
static VOID ActionOK2( PGPFPARMS pGpfParms );
static VOID WmInitWndDialogOrg( PGPFPARMS pGpfParms );
static VOID WmActiveDialogOrg( PGPFPARMS pGpfParms );
static VOID WmDeActiveDialogOrg( PGPFPARMS pGpfParms );
static VOID WmCreateDialogOrg( PGPFPARMS pGpfParms );
static VOID WmDestroyDialogOrg( PGPFPARMS pGpfParms );
static VOID WmPaintDialogOrg( PGPFPARMS pGpfParms );
static VOID WmShowDialogOrg( PGPFPARMS pGpfParms );
static VOID WmHideDialogOrg( PGPFPARMS pGpfParms );
static VOID CommandDialogOrg( PGPFPARMS pGpfParms );
/*********************************************************************/
/* */
/* SQL constants */
/* */
/*********************************************************************/
struct sqlca sqlca;
EXEC SQL INCLUDE SQLCA;
EXEC SQL INCLUDE SQLDA;
EXEC SQL BEGIN DECLARE SECTION;
/*
Table : ORG
Creator : USERID
*/
extern char ORG_DEPTNAME [15];
extern short ORG_DEPTNAME_N;
extern short ORG_DEPTNUMB;
extern char ORG_DIVISION [11];
extern short ORG_DIVISION_N;
extern char ORG_LOCATION [14];
extern short ORG_LOCATION_N;
extern short ORG_MANAGER;
extern short ORG_MANAGER_N;
/*
Table : STAFF
Creator : USERID
*/
extern double STAFF_COMM;
extern short STAFF_COMM_N;
extern short STAFF_DEPT;
extern short STAFF_DEPT_N;
extern short STAFF_ID;
extern char STAFF_JOB [6];
extern short STAFF_JOB_N;
extern char STAFF_NAME [10];
extern short STAFF_NAME_N;
extern double STAFF_SALARY;
extern short STAFF_SALARY_N;
extern short STAFF_YEARS;
extern short STAFF_YEARS_N;
EXEC SQL END DECLARE SECTION;
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: ShowAboutWindow */
/* */
/* Show Window "AboutWindow". */
/* */
/**********************************************************************/
BOOL ShowAboutWindow( PVOID pCrtParms )
{
SWP Swp;
HWND hwndPrevious;
HWND hwndFramePrevious;
BOOL Rc;
/* Save Old Hwnd (Recur). */
hwndFramePrevious = hwndFrameAboutWindow;
hwndPrevious = hwndAboutWindow;
CreateAboutWindow(pCrtParms); /* Create New Window */
WinSetWindowPos( hwndFrameAboutWindow,
NULL,0,0,0,0,SWP_RESTORE);
WinQueryWindowPos( hwndFrameAboutWindow, &Swp );
WinSetWindowPos( hwndFrameAboutWindow,
HWND_TOP,
Swp.x,Swp.y,Swp.cx,Swp.cy,
SWP_ZORDER | SWP_SIZE | SWP_MOVE |
SWP_ACTIVATE | SWP_SHOW
);
Rc = GpfProcessWnd( hwndFrameAboutWindow );
/* Destroy Window */
WinDestroyWindow( hwndFrameAboutWindow );
/* Restore Old Hwnd */
hwndFrameAboutWindow = hwndFramePrevious;
hwndAboutWindow = hwndPrevious;
return(Rc);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: DismissAboutWindow */
/* */
/* Dismiss Window Hide - Window "AboutWindow". */
/* */
/**********************************************************************/
VOID DismissAboutWindow( BOOL Rcode )
{
/* Dismiss Window */
GpfDismissWnd(hwndFrameAboutWindow,Rcode);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CreateAboutWindow */
/* */
/* Create the window "AboutWindow" And Controls. */
/* */
/**********************************************************************/
VOID CreateAboutWindow( PVOID pCrtParms)
{
/********************************************************************/
/* Register the window class "AboutWindow". */
/********************************************************************/
WinRegisterClass( /* Register window class */
habAboutTask, /* Anchor block handle */
"AboutWindow", /* Window class name */
fnwpAboutWindow, /* Address window procedure */
CS_CLIPSIBLINGS | CS_SAVEBITS | /* Class style */
CS_MOVENOTIFY | /* Class style */
CS_SIZEREDRAW | CS_SYNCPAINT, /* Class style */
EXTRAWORDS /* Extra window words */
);
/********************************************************************/
/* Create the window "AboutWindow". */
/********************************************************************/
hwndFrameAboutWindow = /* Save Hwnd */
GpfCreateTemplate( ID_ABOUTWINDOW, /* Ressource Id */
hmodSample, /* Ressource Md */
HWND_DESKTOP, /* Hwnd Parent */
HWND_DESKTOP, /* Hwnd Owner */
pCrtParms); /* User Parms */
}
/**********************************************************************/
/* End of Private Function - CreateAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* WinProc: fnwpAboutWindow */
/* */
/* Controls the "AboutWindow" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpAboutWindow(
HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
HPS hps; /* Presentation space handle */
RECTL rcl; /* Window rectangle */
PGPFPARMS pGpfParms; /* Far Pointer */
SEL Selector; /* Seloctor */
/*******************************************************************/
/* Initialize Gpf Parameters */
/*******************************************************************/
pGpfParms = (PGPFPARMS) WinQueryWindowULong(hwnd,QWL_USER);
if (pGpfParms)
{
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->mresult = (MRESULT) FALSE; /* Mresult */
pGpfParms->Command = 0; /* Command From mp1 (SHORT 1) */
pGpfParms->Notify = 0; /* Notify From mp1 (SHORT 2) */
}
switch(msg)
{
/**************************************************************/
/* Things to do when the Window is first initalized */
/**************************************************************/
case WM_INITDLG:
/**************************************************************/
/* Initialize Window 'AboutWindow' */
/**************************************************************/
GpfDefWindowProc( hwnd, msg, mp1, mp2 );
WmInitWndAboutWindow(pGpfParms); /* Init Dialog */
/**************************************************************/
/* Return pGpfParms Mresult */
/**************************************************************/
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is End LogoTimer */
/**************************************************************/
case WM_TIMER:
WinStopTimer(WinQueryAnchorBlock(hwnd),
hwnd,TID_USERMAX); /* Stop LogoTimer */
/**************************************************************/
/* Simulate CANCEL - Post Did CANCEL to Window */
/**************************************************************/
WinPostMsg( hwnd,
WM_COMMAND, /* simulate CANCEL */
MPFROM2SHORT( DID_CANCEL , 0 ),
MPFROM2SHORT( CMDSRC_OTHER , 0 )
);
break;
/**************************************************************/
/* Things to do when the Window is Activated/Deactivated */
/**************************************************************/
case WM_ACTIVATE:
if (SHORT1FROMMP(mp1))
WmActiveAboutWindow(pGpfParms); /* Activate Window */
else
WmDeActiveAboutWindow(pGpfParms); /* DeActivate Window */
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is "Show/Hide" */
/**************************************************************/
case WM_SHOW:
if (SHORT1FROMMP(mp1))
WmShowAboutWindow(pGpfParms); /* Show Window */
else
WmHideAboutWindow(pGpfParms); /* Hide Window */
return (pGpfParms->mresult);
/**************************************************************/
/* The application has asked for the window to be created. */
/**************************************************************/
case WM_CREATE:
DosAllocSeg(sizeof(GPFPARMS),&Selector,0); /* Getmain */
pGpfParms = MAKEP(Selector, 0); /* Set Pointer*/
WinSetWindowULong(hwnd,QWL_USER,(ULONG)pGpfParms);
memset(pGpfParms,0,sizeof(GPFPARMS)); /* Clear Area */
hwndAboutWindow = hwnd; /* Save Hwnd */
hwndFrameAboutWindow = GpfGetHwndFrame(hwnd);
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->hmod = hmodSample;
pGpfParms->hab = habAboutTask; /* Anchor block handle */
WmCreateAboutWindow(pGpfParms); /* Create Window */
break;
/**************************************************************/
/* The application has asked for the window to be destroyed. */
/**************************************************************/
case WM_DESTROY:
WinStopTimer(WinQueryAnchorBlock(hwnd),
hwnd,TID_USERMAX); /* Stop LogoTimer */
WmDestroyAboutWindow(pGpfParms); /* Destroy Window */
hwndFrameAboutWindow = (HWND)NULL; /* Reset HwndFrm */
hwndAboutWindow = (HWND)NULL; /* Reset Hwnd */
/* Destroy Template , Help Instance and GpfParms */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* The window needs painting. */
/**************************************************************/
case WM_PAINT:
/**************************************************************/
/* Obtain a cache PS */
/**************************************************************/
hps = WinBeginPaint( hwnd, (HPS)NULL, (PRECTL)&rcl );
WinFillRect(hps,&rcl,pGpfParms->BgColor); /* Fill Rect */
pGpfParms->hps = hps; /* Pass Hps ( Paint ) */
WmPaintAboutWindow(pGpfParms); /* Paint Window */
WinEndPaint( hps ); /* Release cache PS */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process ScrollBar received from the user */
/**************************************************************/
case WM_VSCROLL:
case WM_HSCROLL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp2 */
pGpfParms->Notify = SHORT2FROMMP( mp2 );
CommandAboutWindow( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process Controls received from the user */
/**************************************************************/
case WM_CONTROL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp1 */
pGpfParms->Notify = SHORT2FROMMP( mp1 );
CommandAboutWindow( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process commands received from the user */
/**************************************************************/
case WM_SYSCOMMAND:
case WM_HELP:
case WM_COMMAND:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
pGpfParms->Notify = COMMAND; /* Set Notify From mp1 */
CommandAboutWindow( pGpfParms ); /* Process the command */
if (pGpfParms->mresult)
return (pGpfParms->mresult);
/* If DID_CANCEL Dismiss Window */
if (pGpfParms->Command == DID_CANCEL)
DismissAboutWindow(FALSE);
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* All other messages are passed to the default procedure. */
/**************************************************************/
default:
/* Pass all other messages to the default window procedure */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
}
return ((MRESULT) FALSE);
}
/**********************************************************************/
/* End of window procedure - WinProc: fnwpAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CommandAboutWindow */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID CommandAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) TRUE; /* Set Return Code */
/* Switch according to Control chosen */
switch( pGpfParms->Command )
{
/******************************************************************/
/* Name "AboutOk". */
/* Alias "DID_CANCEL". */
/* Text "~Ok". */
/******************************************************************/
case ID_ABOUTOK:
case DID_CANCEL:
ActionAboutOk(pGpfParms);
return;
}
/* Take no action for any other selections */
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: CommandAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionAboutOk */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID ActionAboutOk( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Dismiss Window Hide Window "AboutWindow". */
/**************************************************************/
DismissAboutWindow(FALSE);
/**************************************************************/
/* Enable Menu/Item "About". */
/* Window "MainWindow". */
/**************************************************************/
GpfMenuGray(hwndFrameMainWindow,ID_ABOUT,FALSE);
/**************************************************************/
/* Enable Menu/Item "About1". */
/* Window "MainWindow". */
/**************************************************************/
GpfMenuGray(hwndFrameMainWindow,ID_ABOUT1,FALSE);
/**************************************************************/
/* Enable Control "UserButton". */
/* Window "ListStaffWindow". */
/**************************************************************/
WinEnableWindow(WinWindowFromID( hwndListStaffWindow,
ID_USERBUTTON),
TRUE);
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveAboutWindowToData */
/* */
/* Move "AboutWindow" To Assosiate Data. */
/* */
/**********************************************************************/
BOOL MoveAboutWindowToData ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveAboutWindowToData */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDataToAboutWindow */
/* */
/* Move Data To Window "AboutWindow". */
/* */
/**********************************************************************/
BOOL MoveDataToAboutWindow ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDataToAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmInitWndAboutWindow */
/* */
/* Wm Init Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmInitWndAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
/**************************************************************/
/* Center Window "AboutWindow". */
/* Positions Window in the center of the screen */
/**************************************************************/
GpfSetCentreWindow(hwndFrameAboutWindow);
}
/**********************************************************************/
/* End of Private Function: WmInitWndAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmActiveAboutWindow */
/* */
/* Wm Activate Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmActiveAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
WinStartTimer(WinQueryAnchorBlock(pGpfParms->hwnd),
pGpfParms->hwnd,TID_USERMAX,LogoTimer);
LogoTimer = -1; /* Set Indefinite LogoTimer */
}
/**********************************************************************/
/* End of Private Function: WmActiveAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDeActiveAboutWindow */
/* */
/* DeActivate Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmDeActiveAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDeActiveAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmCreateAboutWindow */
/* */
/* Wm Create Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmCreateAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmCreateAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDestroyAboutWindow */
/* */
/* Wm Destroy Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmDestroyAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDestroyAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmPaintAboutWindow */
/* */
/* Wm Paint Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmPaintAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmPaintAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmShowAboutWindow */
/* */
/* Wm Show Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmShowAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmShowAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmHideAboutWindow */
/* */
/* Wm Hide Window "AboutWindow". */
/* */
/**********************************************************************/
static VOID WmHideAboutWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmHideAboutWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: ShowDialogStaff */
/* */
/* Show Window "DialogStaff". */
/* */
/**********************************************************************/
BOOL ShowDialogStaff( PVOID pCrtParms )
{
SWP Swp;
HWND hwndPrevious;
HWND hwndFramePrevious;
BOOL Rc;
/* Save Old Hwnd (Recur). */
hwndFramePrevious = hwndFrameDialogStaff;
hwndPrevious = hwndDialogStaff;
CreateDialogStaff(pCrtParms); /* Create New Window */
WinSetWindowPos( hwndFrameDialogStaff,
NULL,0,0,0,0,SWP_RESTORE);
WinQueryWindowPos( hwndFrameDialogStaff, &Swp );
WinSetWindowPos( hwndFrameDialogStaff,
HWND_TOP,
Swp.x,Swp.y,Swp.cx,Swp.cy,
SWP_ZORDER | SWP_SIZE | SWP_MOVE |
SWP_ACTIVATE | SWP_SHOW
);
Rc = GpfProcessWnd( hwndFrameDialogStaff );
/* Destroy Window */
WinDestroyWindow( hwndFrameDialogStaff );
/* Restore Old Hwnd */
hwndFrameDialogStaff = hwndFramePrevious;
hwndDialogStaff = hwndPrevious;
return(Rc);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: DismissDialogStaff */
/* */
/* Dismiss Window Hide - Window "DialogStaff". */
/* */
/**********************************************************************/
VOID DismissDialogStaff( BOOL Rcode )
{
/* Dismiss Window */
GpfDismissWnd(hwndFrameDialogStaff,Rcode);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CreateDialogStaff */
/* */
/* Create the window "DialogStaff" And Controls. */
/* */
/**********************************************************************/
VOID CreateDialogStaff( PVOID pCrtParms)
{
/********************************************************************/
/* Register the window class "DialogStaff". */
/********************************************************************/
WinRegisterClass( /* Register window class */
habMainTask, /* Anchor block handle */
"DialogStaff", /* Window class name */
fnwpDialogStaff, /* Address window procedure */
CS_CLIPSIBLINGS | CS_SAVEBITS | /* Class style */
CS_MOVENOTIFY | /* Class style */
CS_SIZEREDRAW | CS_SYNCPAINT, /* Class style */
EXTRAWORDS /* Extra window words */
);
/********************************************************************/
/* Create the window "DialogStaff". */
/********************************************************************/
hwndFrameDialogStaff = /* Save Hwnd */
GpfCreateTemplate( ID_DIALOGSTAFF, /* Ressource Id */
hmodSample, /* Ressource Md */
HWND_DESKTOP, /* Hwnd Parent */
HWND_DESKTOP, /* Hwnd Owner */
pCrtParms); /* User Parms */
}
/**********************************************************************/
/* End of Private Function - CreateDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* WinProc: fnwpDialogStaff */
/* */
/* Controls the "DialogStaff" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpDialogStaff(
HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
HPS hps; /* Presentation space handle */
RECTL rcl; /* Window rectangle */
PGPFPARMS pGpfParms; /* Far Pointer */
SEL Selector; /* Seloctor */
/*******************************************************************/
/* Initialize Gpf Parameters */
/*******************************************************************/
pGpfParms = (PGPFPARMS) WinQueryWindowULong(hwnd,QWL_USER);
if (pGpfParms)
{
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->mresult = (MRESULT) FALSE; /* Mresult */
pGpfParms->Command = 0; /* Command From mp1 (SHORT 1) */
pGpfParms->Notify = 0; /* Notify From mp1 (SHORT 2) */
}
switch(msg)
{
/**************************************************************/
/* Things to do when the Window is first initalized */
/**************************************************************/
case WM_INITDLG:
/**************************************************************/
/* Initialize Window 'DialogStaff' */
/**************************************************************/
GpfDefWindowProc( hwnd, msg, mp1, mp2 );
WmInitWndDialogStaff(pGpfParms); /* Init Dialog */
/**************************************************************/
/* Return pGpfParms Mresult */
/**************************************************************/
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is Activated/Deactivated */
/**************************************************************/
case WM_ACTIVATE:
if (SHORT1FROMMP(mp1))
WmActiveDialogStaff(pGpfParms); /* Activate Window */
else
WmDeActiveDialogStaff(pGpfParms); /* DeActivate Window */
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is "Show/Hide" */
/**************************************************************/
case WM_SHOW:
if (SHORT1FROMMP(mp1))
WmShowDialogStaff(pGpfParms); /* Show Window */
else
WmHideDialogStaff(pGpfParms); /* Hide Window */
return (pGpfParms->mresult);
/**************************************************************/
/* The application has asked for the window to be created. */
/**************************************************************/
case WM_CREATE:
DosAllocSeg(sizeof(GPFPARMS),&Selector,0); /* Getmain */
pGpfParms = MAKEP(Selector, 0); /* Set Pointer*/
WinSetWindowULong(hwnd,QWL_USER,(ULONG)pGpfParms);
memset(pGpfParms,0,sizeof(GPFPARMS)); /* Clear Area */
pGpfParms->Options |= GPF_OP_MSGINFO; /* Set Msg Info */
pGpfParms->Options |= GPF_OP_ADJUSTSIZE; /* Set AdjustSize */
hwndDialogStaff = hwnd; /* Save Hwnd */
hwndFrameDialogStaff = GpfGetHwndFrame(hwnd);
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->hmod = hmodSample;
pGpfParms->hab = habMainTask; /* Anchor block handle */
WmCreateDialogStaff(pGpfParms); /* Create Window */
break;
/**************************************************************/
/* The application has asked for the window to be destroyed. */
/**************************************************************/
case WM_DESTROY:
WmDestroyDialogStaff(pGpfParms); /* Destroy Window */
hwndFrameDialogStaff = (HWND)NULL; /* Reset HwndFrm */
hwndDialogStaff = (HWND)NULL; /* Reset Hwnd */
/* Destroy Template , Help Instance and GpfParms */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* The window needs painting. */
/**************************************************************/
case WM_PAINT:
/**************************************************************/
/* Obtain a cache PS */
/**************************************************************/
hps = WinBeginPaint( hwnd, (HPS)NULL, (PRECTL)&rcl );
WinFillRect(hps,&rcl,pGpfParms->BgColor); /* Fill Rect */
pGpfParms->hps = hps; /* Pass Hps ( Paint ) */
WmPaintDialogStaff(pGpfParms); /* Paint Window */
WinEndPaint( hps ); /* Release cache PS */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process ScrollBar received from the user */
/**************************************************************/
case WM_VSCROLL:
case WM_HSCROLL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp2 */
pGpfParms->Notify = SHORT2FROMMP( mp2 );
CommandDialogStaff( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process Controls received from the user */
/**************************************************************/
case WM_CONTROL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp1 */
pGpfParms->Notify = SHORT2FROMMP( mp1 );
CommandDialogStaff( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process commands received from the user */
/**************************************************************/
case WM_SYSCOMMAND:
case WM_HELP:
case WM_COMMAND:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
pGpfParms->Notify = COMMAND; /* Set Notify From mp1 */
CommandDialogStaff( pGpfParms ); /* Process the command */
if (pGpfParms->mresult)
return (pGpfParms->mresult);
/* If DID_CANCEL Dismiss Window */
if (pGpfParms->Command == DID_CANCEL)
DismissDialogStaff(FALSE);
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* All other messages are passed to the default procedure. */
/**************************************************************/
default:
/* Pass all other messages to the default window procedure */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
}
return ((MRESULT) FALSE);
}
/**********************************************************************/
/* End of window procedure - WinProc: fnwpDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CommandDialogStaff */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID CommandDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) TRUE; /* Set Return Code */
/* Switch according to Control chosen */
switch( pGpfParms->Command )
{
/******************************************************************/
/* Name "Ok". */
/* Alias "DID_CANCEL". */
/* Text "~OK". */
/******************************************************************/
case ID_OK:
case DID_CANCEL:
ActionOk(pGpfParms);
return;
}
/* Take no action for any other selections */
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: CommandDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionOk */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID ActionOk( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Dismiss Window Hide Window "DialogStaff". */
/**************************************************************/
DismissDialogStaff(FALSE);
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDialogStaffToData */
/* */
/* Move "DialogStaff" To Assosiate Data. */
/* */
/**********************************************************************/
BOOL MoveDialogStaffToData ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
/**********************************************************************/
/* Move "ID_ID" To "STAFF_ID". (SMALLINT) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_ID),
sizeof(String),
String);
if (!GpfStringIsNumeric(String))
{
WinSetFocus( HWND_DESKTOP,
WinWindowFromID(hwndDialogStaff,ID_ID));
return FALSE;
}
STAFF_ID = atoi(String); /* Convert String to Short */
/**********************************************************************/
/* Move "ID_NAME" To "STAFF_NAME". (VARCHAR) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_NAME),
sizeof(STAFF_NAME),
STAFF_NAME);
if (!STAFF_NAME[0]) /* If Null Data */
STAFF_NAME_N = -1; /* Set Sql Null Indicator */
/**********************************************************************/
/* Move "ID_JOB" To "STAFF_JOB". (CHAR) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_JOB),
sizeof(STAFF_JOB),
STAFF_JOB);
if (!STAFF_JOB[0]) /* If Null Data */
STAFF_JOB_N = -1; /* Set Sql Null Indicator */
/**********************************************************************/
/* Move "ID_DEPT" To "STAFF_DEPT". (SMALLINT) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_DEPT),
sizeof(String),
String);
if (!GpfStringIsNumeric(String))
{
WinSetFocus( HWND_DESKTOP,
WinWindowFromID(hwndDialogStaff,ID_DEPT));
return FALSE;
}
STAFF_DEPT = atoi(String); /* Convert String to Short */
STAFF_DEPT_N = 0; /* Reset Sql Null Indicator*/
/**********************************************************************/
/* Move "ID_SALARY" To "STAFF_SALARY". (DECIMAL) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_SALARY),
sizeof(String),
String);
Token = strrchr(String,sDecimal[0]); /* Search National Decimal */
if (Token) /* If Found */
*(Token) = '.'; /* Change to US Decimal */
sscanf(String,"%lf",&STAFF_SALARY); /* Convert String to Float */
STAFF_SALARY_N = 0; /* Reset Sql Null Indicator*/
/**********************************************************************/
/* Move "ID_COMM" To "STAFF_COMM". (DECIMAL) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogStaff,
ID_COMM),
sizeof(String),
String);
Token = strrchr(String,sDecimal[0]); /* Search National Decimal */
if (Token) /* If Found */
*(Token) = '.'; /* Change to US Decimal */
sscanf(String,"%lf",&STAFF_COMM); /* Convert String to Float */
STAFF_COMM_N = 0; /* Reset Sql Null Indicator*/
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDialogStaffToData */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDataToDialogStaff */
/* */
/* Move Data To Window "DialogStaff". */
/* */
/**********************************************************************/
BOOL MoveDataToDialogStaff ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
/**********************************************************************/
/* Move "STAFF_ID" To "ID_ID". (SMALLINT) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_ID,
EM_SETTEXTLIMIT,
MPFROMSHORT( 5 ),
MPFROMSHORT( NULL ) );
itoa(STAFF_ID,String,10); /* Convert to string */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_ID),
String);
/**********************************************************************/
/* Move "STAFF_NAME" To "ID_NAME". (VARCHAR) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_NAME,
EM_SETTEXTLIMIT,
MPFROMSHORT( sizeof(STAFF_NAME) -1 ),
MPFROMSHORT( NULL ) );
if (STAFF_NAME_N < 0) /* If Null Indicator */
STAFF_NAME[0] = 0; /* Set Null Data */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_NAME),
STAFF_NAME);
/**********************************************************************/
/* Move "STAFF_JOB" To "ID_JOB". (CHAR) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_JOB,
EM_SETTEXTLIMIT,
MPFROMSHORT( sizeof(STAFF_JOB) -1 ),
MPFROMSHORT( NULL ) );
if (STAFF_JOB_N < 0) /* If Null Indicator */
STAFF_JOB[0] = 0; /* Set Null Data */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_JOB),
STAFF_JOB);
/**********************************************************************/
/* Move "STAFF_DEPT" To "ID_DEPT". (SMALLINT) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_DEPT,
EM_SETTEXTLIMIT,
MPFROMSHORT( 5 ),
MPFROMSHORT( NULL ) );
if (STAFF_DEPT_N < 0) /* If Null Indicator */
String[0] = 0; /* Set Null Data */
else
itoa(STAFF_DEPT,String,10); /* Convert to string */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_DEPT),
String);
/**********************************************************************/
/* Move "STAFF_SALARY" To "ID_SALARY". (DECIMAL) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_SALARY,
EM_SETTEXTLIMIT,
MPFROMSHORT( 8 ),
MPFROMSHORT( NULL ) );
if (STAFF_SALARY_N < 0) /* If Null Indicator */
String[0] = 0; /* Set Null Data */
else
sprintf(String,"%.2f",STAFF_SALARY); /* Convert to string */
Token = strrchr(String,'.'); /* Search US Decimal */
if (Token) /* If Found */
*(Token) = sDecimal[0]; /* Change to National Decimal */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_SALARY),
String);
/**********************************************************************/
/* Move "STAFF_COMM" To "ID_COMM". (DECIMAL) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogStaff,
ID_COMM,
EM_SETTEXTLIMIT,
MPFROMSHORT( 8 ),
MPFROMSHORT( NULL ) );
if (STAFF_COMM_N < 0) /* If Null Indicator */
String[0] = 0; /* Set Null Data */
else
sprintf(String,"%.2f",STAFF_COMM); /* Convert to string */
Token = strrchr(String,'.'); /* Search US Decimal */
if (Token) /* If Found */
*(Token) = sDecimal[0]; /* Change to National Decimal */
WinSetWindowText( WinWindowFromID( hwndDialogStaff,
ID_COMM),
String);
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDataToDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmInitWndDialogStaff */
/* */
/* Wm Init Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmInitWndDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
/**************************************************************/
/* Center Window "DialogStaff". */
/* Positions Window in the center of the screen */
/**************************************************************/
GpfSetCentreWindow(hwndFrameDialogStaff);
/**************************************************************/
/* Move Data To Window "DialogStaff". */
/**************************************************************/
MoveDataToDialogStaff();
}
/**********************************************************************/
/* End of Private Function: WmInitWndDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmActiveDialogStaff */
/* */
/* Wm Activate Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmActiveDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmActiveDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDeActiveDialogStaff */
/* */
/* DeActivate Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmDeActiveDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDeActiveDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmCreateDialogStaff */
/* */
/* Wm Create Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmCreateDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmCreateDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDestroyDialogStaff */
/* */
/* Wm Destroy Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmDestroyDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDestroyDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmPaintDialogStaff */
/* */
/* Wm Paint Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmPaintDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmPaintDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmShowDialogStaff */
/* */
/* Wm Show Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmShowDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmShowDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmHideDialogStaff */
/* */
/* Wm Hide Window "DialogStaff". */
/* */
/**********************************************************************/
static VOID WmHideDialogStaff ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmHideDialogStaff */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: ShowListOrgWindow */
/* */
/* Show Window "ListOrgWindow". */
/* */
/**********************************************************************/
BOOL ShowListOrgWindow( PVOID pCrtParms )
{
SWP Swp;
/* Make sure the window was not created. */
if (!hwndFrameListOrgWindow)
CreateListOrgWindow(pCrtParms);
WinSetWindowPos( hwndFrameListOrgWindow,
NULL,0,0,0,0,SWP_RESTORE);
WinQueryWindowPos( hwndFrameListOrgWindow, &Swp );
WinSetWindowPos( hwndFrameListOrgWindow,
HWND_TOP,
Swp.x,Swp.y,Swp.cx,Swp.cy,
SWP_ZORDER | SWP_SIZE | SWP_MOVE |
SWP_ACTIVATE | SWP_SHOW
);
return(FALSE);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: DismissListOrgWindow */
/* */
/* Dismiss Window Hide - Window "ListOrgWindow". */
/* */
/**********************************************************************/
VOID DismissListOrgWindow( BOOL Rcode )
{
Rcode = Rcode; /* Null , For Delete Unreferenced Formal Parameter */
/* Hide Window */
WinShowWindow(hwndFrameListOrgWindow, FALSE);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CreateListOrgWindow */
/* */
/* Create the window "ListOrgWindow" And Controls. */
/* */
/**********************************************************************/
VOID CreateListOrgWindow( PVOID pCrtParms)
{
/********************************************************************/
/* Register the window class "ListOrgWindow". */
/********************************************************************/
WinRegisterClass( /* Register window class */
habMainTask, /* Anchor block handle */
"ListOrgWindow", /* Window class name */
fnwpListOrgWindow, /* Address window procedure */
CS_CLIPSIBLINGS | CS_SAVEBITS | /* Class style */
CS_MOVENOTIFY | /* Class style */
CS_SIZEREDRAW | CS_SYNCPAINT, /* Class style */
EXTRAWORDS /* Extra window words */
);
/********************************************************************/
/* Create the window "ListOrgWindow". */
/********************************************************************/
hwndFrameListOrgWindow = /* Save Hwnd */
GpfCreateTemplate( ID_LISTORGWINDOW, /* Ressource Id */
hmodSample, /* Ressource Md */
hwndMainWindow, /* Hwnd Parent */
hwndMainWindow, /* Hwnd Owner */
pCrtParms); /* User Parms */
}
/**********************************************************************/
/* End of Private Function - CreateListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* WinProc: fnwpListOrgWindow */
/* */
/* Controls the "ListOrgWindow" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpListOrgWindow(
HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
HPS hps; /* Presentation space handle */
RECTL rcl; /* Window rectangle */
PGPFPARMS pGpfParms; /* Far Pointer */
SEL Selector; /* Seloctor */
/*******************************************************************/
/* Initialize Gpf Parameters */
/*******************************************************************/
pGpfParms = (PGPFPARMS) WinQueryWindowULong(hwnd,QWL_USER);
if (pGpfParms)
{
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->mresult = (MRESULT) FALSE; /* Mresult */
pGpfParms->Command = 0; /* Command From mp1 (SHORT 1) */
pGpfParms->Notify = 0; /* Notify From mp1 (SHORT 2) */
}
switch(msg)
{
/**************************************************************/
/* Things to do when the Window is first initalized */
/**************************************************************/
case WM_INITDLG:
/**************************************************************/
/* Initialize Window 'ListOrgWindow' */
/**************************************************************/
GpfDefWindowProc( hwnd, msg, mp1, mp2 );
WmInitWndListOrgWindow(pGpfParms); /* Init Dialog */
/**************************************************************/
/* Return pGpfParms Mresult */
/**************************************************************/
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is Activated/Deactivated */
/**************************************************************/
case WM_ACTIVATE:
if (SHORT1FROMMP(mp1))
WmActiveListOrgWindow(pGpfParms); /* Activate Window */
else
WmDeActiveListOrgWindow(pGpfParms); /* DeActivate Window */
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is "Show/Hide" */
/**************************************************************/
case WM_SHOW:
if (SHORT1FROMMP(mp1))
WmShowListOrgWindow(pGpfParms); /* Show Window */
else
WmHideListOrgWindow(pGpfParms); /* Hide Window */
return (pGpfParms->mresult);
/**************************************************************/
/* The application has asked for the window to be created. */
/**************************************************************/
case WM_CREATE:
DosAllocSeg(sizeof(GPFPARMS),&Selector,0); /* Getmain */
pGpfParms = MAKEP(Selector, 0); /* Set Pointer*/
WinSetWindowULong(hwnd,QWL_USER,(ULONG)pGpfParms);
memset(pGpfParms,0,sizeof(GPFPARMS)); /* Clear Area */
pGpfParms->Options |= GPF_OP_ADJUSTSIZE; /* Set AdjustSize */
hwndListOrgWindow = hwnd; /* Save Hwnd */
hwndFrameListOrgWindow = GpfGetHwndFrame(hwnd);
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->hmod = hmodSample;
pGpfParms->hab = habMainTask; /* Anchor block handle */
WmCreateListOrgWindow(pGpfParms); /* Create Window */
break;
/**************************************************************/
/* The application has asked for the window to be destroyed. */
/**************************************************************/
case WM_DESTROY:
WmDestroyListOrgWindow(pGpfParms); /* Destroy Window */
hwndFrameListOrgWindow = (HWND)NULL; /* Reset HwndFrm */
hwndListOrgWindow = (HWND)NULL; /* Reset Hwnd */
/* Destroy Template , Help Instance and GpfParms */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* The window needs painting. */
/**************************************************************/
case WM_PAINT:
/**************************************************************/
/* Obtain a cache PS */
/**************************************************************/
hps = WinBeginPaint( hwnd, (HPS)NULL, (PRECTL)&rcl );
WinFillRect(hps,&rcl,pGpfParms->BgColor); /* Fill Rect */
pGpfParms->hps = hps; /* Pass Hps ( Paint ) */
WmPaintListOrgWindow(pGpfParms); /* Paint Window */
WinEndPaint( hps ); /* Release cache PS */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process ScrollBar received from the user */
/**************************************************************/
case WM_VSCROLL:
case WM_HSCROLL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp2 */
pGpfParms->Notify = SHORT2FROMMP( mp2 );
CommandListOrgWindow( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process Controls received from the user */
/**************************************************************/
case WM_CONTROL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp1 */
pGpfParms->Notify = SHORT2FROMMP( mp1 );
CommandListOrgWindow( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process commands received from the user */
/**************************************************************/
case WM_SYSCOMMAND:
case WM_HELP:
case WM_COMMAND:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
pGpfParms->Notify = COMMAND; /* Set Notify From mp1 */
CommandListOrgWindow( pGpfParms ); /* Process the command */
if (pGpfParms->mresult)
return (pGpfParms->mresult);
/* If DID_CANCEL Dismiss Window */
if (pGpfParms->Command == DID_CANCEL)
DismissListOrgWindow(FALSE);
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* All other messages are passed to the default procedure. */
/**************************************************************/
default:
/* Pass all other messages to the default window procedure */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
}
return ((MRESULT) FALSE);
}
/**********************************************************************/
/* End of window procedure - WinProc: fnwpListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CommandListOrgWindow */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID CommandListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) TRUE; /* Set Return Code */
/* Switch according to Control chosen */
switch( pGpfParms->Command )
{
/******************************************************************/
/* Name "ListBoxOrg". */
/* Text "Text". */
/******************************************************************/
case ID_LISTBOXORG:
ActionListBoxOrg(pGpfParms);
return;
/******************************************************************/
/* Name "ShowOrg". */
/* Alias "DID_OK". */
/* Text "~Show Org". */
/******************************************************************/
case ID_SHOWORG:
case DID_OK:
ActionShowOrg(pGpfParms);
return;
/******************************************************************/
/* Name "Cancel1". */
/* Alias "DID_CANCEL". */
/* Text "Cancel". */
/******************************************************************/
case ID_CANCEL1:
case DID_CANCEL:
ActionCancel1(pGpfParms);
return;
/******************************************************************/
/* Name "ButtonHelp1". */
/* Text "~Help". */
/******************************************************************/
case ID_BUTTONHELP1:
ActionButtonHelp1(pGpfParms);
return;
}
/* Take no action for any other selections */
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: CommandListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionShowOrg */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID ActionShowOrg( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Reset Default Button Window "ListOrgWindow". */
/**************************************************************/
GpfResetDefaultButton(hwndListOrgWindow);
/**************************************************************/
/* Get Selection "ListBoxOrg". */
/* Window "ListOrgWindow". */
/**************************************************************/
GetSelBoxListBoxOrg();
/**************************************************************/
/* Show Window "DialogOrg". */
/**************************************************************/
ShowDialogOrg(NULL);
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionCancel1 */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID ActionCancel1( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Dismiss Window Hide Window "ListOrgWindow". */
/**************************************************************/
DismissListOrgWindow(FALSE);
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionButtonHelp1 */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID ActionButtonHelp1( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Help Extended for Window "ListOrgWindow". */
/**************************************************************/
if (hwndHelp)
WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
MPFROMSHORT( ID_LISTORGWINDOW ),
0L );
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionListBoxOrg */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID ActionListBoxOrg( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case LN_ENTER: /* Catch double click on */
/**************************************************************/
/* Reset Default Button Window "ListOrgWindow". */
/**************************************************************/
GpfResetDefaultButton(hwndListOrgWindow);
/**************************************************************/
/* Simulate OK - Send Did OK to Window */
/* "ListOrgWindow". */
/*************************************************************/
WinSendMsg( hwndListOrgWindow,
WM_COMMAND, /* simulate OK */
MPFROM2SHORT( DID_OK , 0 ),
MPFROM2SHORT( CMDSRC_OTHER , 0 )
);
return;
case LN_SELECT: /* Catch click on */
return;
case LN_KILLFOCUS: /* Kill Focus */
return;
case LN_SETFOCUS: /* Set Focus */
return;
case LN_SCROLL: /* Scroll */
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveListOrgWindowToData */
/* */
/* Move "ListOrgWindow" To Assosiate Data. */
/* */
/**********************************************************************/
BOOL MoveListOrgWindowToData ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveListOrgWindowToData */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDataToListOrgWindow */
/* */
/* Move Data To Window "ListOrgWindow". */
/* */
/**********************************************************************/
BOOL MoveDataToListOrgWindow ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDataToListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmInitWndListOrgWindow */
/* */
/* Wm Init Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmInitWndListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
/**************************************************************/
/* Load ListBox / ComboBox "ListBoxOrg". */
/* Window "ListOrgWindow". */
/**************************************************************/
/* Send Msg for Execute LoadBoxListBoxOrg(); */
GpfExecuteSql(LoadBoxListBoxOrg,hwndListOrgWindow);
/* Wait Async Execute LoadBoxListBoxOrg(); */
GpfSqlWait(hwndListOrgWindow);
}
/**********************************************************************/
/* End of Private Function: WmInitWndListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmActiveListOrgWindow */
/* */
/* Wm Activate Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmActiveListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmActiveListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDeActiveListOrgWindow */
/* */
/* DeActivate Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmDeActiveListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDeActiveListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmCreateListOrgWindow */
/* */
/* Wm Create Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmCreateListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmCreateListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDestroyListOrgWindow */
/* */
/* Wm Destroy Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmDestroyListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDestroyListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmPaintListOrgWindow */
/* */
/* Wm Paint Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmPaintListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmPaintListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmShowListOrgWindow */
/* */
/* Wm Show Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmShowListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmShowListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmHideListOrgWindow */
/* */
/* Wm Hide Window "ListOrgWindow". */
/* */
/**********************************************************************/
static VOID WmHideListOrgWindow ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmHideListOrgWindow */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: LoadBoxListBoxOrg */
/* */
/* Load Box To ID_LISTBOXORG */
/* */
/**********************************************************************/
LONG LoadBoxListBoxOrg( VOID )
{
UCHAR String[256];
PUCHAR Token = NULL;
SHORT i;
/***************************************************/
/* clear out both list boxes in preperation for a */
/* refresh given the new environment */
/***************************************************/
WinSendDlgItemMsg(hwndListOrgWindow,
ID_LISTBOXORG,
LM_DELETEALL,
MPFROMSHORT( NULL ),
MPFROMSHORT( NULL ) );
/********************************/
/* Declare Sql Cursor */
/********************************/
EXEC SQL DECLARE CURSOR_10119 CURSOR FOR SELECT
DEPTNAME,
DEPTNUMB,
DIVISION,
LOCATION,
MANAGER
FROM ORG ;
/********************************/
/* Open Sql Cursor */
/********************************/
/* Position cursor at first record */
EXEC SQL OPEN CURSOR_10119;
GpfDisplaySqlError(&sqlca);
while (!sqlca.sqlcode)
{
ORG_DEPTNAME[0] = 0;
ORG_DEPTNUMB = 0;
ORG_DIVISION[0] = 0;
ORG_LOCATION[0] = 0;
ORG_MANAGER = 0;
/******************************************************/
/* Fetch next row inorder to properly position cursor */
/******************************************************/
EXEC SQL FETCH CURSOR_10119 INTO
:ORG_DEPTNAME :ORG_DEPTNAME_N,
:ORG_DEPTNUMB,
:ORG_DIVISION :ORG_DIVISION_N,
:ORG_LOCATION :ORG_LOCATION_N,
:ORG_MANAGER :ORG_MANAGER_N;
GpfDisplaySqlError(&sqlca);
if (!sqlca.sqlcode)
{
/********************************/
/* Add Item to ListBox/ComboBox */
/********************************/
i = 0;
i += sprintf(&String[i],"%-14s\xFF",ORG_DEPTNAME);
i += sprintf(&String[i]," %6d\xFF",ORG_DEPTNUMB);
i += sprintf(&String[i],"%-10s\xFF",ORG_DIVISION);
i += sprintf(&String[i],"%-13s\xFF",ORG_LOCATION);
i += sprintf(&String[i]," %6d\xFF",ORG_MANAGER);
WinSendDlgItemMsg ( hwndListOrgWindow,
ID_LISTBOXORG,
LM_INSERTITEM,
MPFROM2SHORT(LIT_END,0),
MPFROMP( String ));
}
}
/********************************/
/* Close Sql Cursor */
/********************************/
EXEC SQL CLOSE CURSOR_10119;
GpfDisplaySqlError(&sqlca);
/********************************/
/* Commit and Drop Lock */
/********************************/
EXEC SQL COMMIT WORK; /* Drop Table any table locks */
GpfDisplaySqlError(&sqlca);
/***************************************************/
/* Make the first list item initially-selected. */
/***************************************************/
WinSendDlgItemMsg(hwndListOrgWindow,
ID_LISTBOXORG,
LM_SELECTITEM,
MPFROMSHORT(0), /* First item index value */
MPFROMSHORT( TRUE ) );
return (LONG)NULL;
}
/**********************************************************************/
/* End of Private Function - LoadBoxListBoxOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: GetSelBoxListBoxOrg */
/* */
/* GetSelection Box To ID_LISTBOXORG */
/* */
/**********************************************************************/
BOOL GetSelBoxListBoxOrg( VOID )
{
UCHAR String[256];
SHORT Position;
PUCHAR Token = (PUCHAR)NULL;
PUCHAR Token1 = (PUCHAR)NULL;
PUCHAR EndToken = (PUCHAR)NULL;
MRESULT mresult;
/*********************************************************************/
/* Get the first selection item. */
/*********************************************************************/
mresult = WinSendDlgItemMsg(
hwndListOrgWindow,
ID_LISTBOXORG,
LM_QUERYSELECTION,
MPFROM2SHORT( LIT_END, 0 ),
MPFROMSHORT( NULL ) );
Position = SHORT1FROMMR(mresult);
/*********************************************************************/
/* When nothing was selected by the user. */
/*********************************************************************/
if ((Position == LIT_NONE) || (Position == LIT_ERROR))
return FALSE;
/*********************************************************************/
/* When something was selected by the user. */
/*********************************************************************/
WinSendDlgItemMsg(hwndListOrgWindow,
ID_LISTBOXORG,
LM_QUERYITEMTEXT,
MPFROM2SHORT(Position,sizeof(String)-1),
MPFROMP( String ) );
Token = String;
/**********************************************************************/
/* Move selected Item by the user. */
/**********************************************************************/
EndToken = strchr(Token,'\xFF');
if(!EndToken)
return FALSE;
*EndToken = 0; /* Set Null Separator */
strcpy(ORG_DEPTNAME,Token);
if (!strlen(Token))
ORG_DEPTNAME_N = -1;
Token = (EndToken+1); /* Token = EndToken + Separator */
/**********************************************************************/
/* Move selected Item by the user. */
/**********************************************************************/
EndToken = strchr(Token,'\xFF');
if(!EndToken)
return FALSE;
*EndToken = 0; /* Set Null Separator */
ORG_DEPTNUMB = atoi(Token);
Token = (EndToken+1); /* Token = EndToken + Separator */
/**********************************************************************/
/* Move selected Item by the user. */
/**********************************************************************/
EndToken = strchr(Token,'\xFF');
if(!EndToken)
return FALSE;
*EndToken = 0; /* Set Null Separator */
strcpy(ORG_DIVISION,Token);
if (!strlen(Token))
ORG_DIVISION_N = -1;
Token = (EndToken+1); /* Token = EndToken + Separator */
/**********************************************************************/
/* Move selected Item by the user. */
/**********************************************************************/
EndToken = strchr(Token,'\xFF');
if(!EndToken)
return FALSE;
*EndToken = 0; /* Set Null Separator */
strcpy(ORG_LOCATION,Token);
if (!strlen(Token))
ORG_LOCATION_N = -1;
Token = (EndToken+1); /* Token = EndToken + Separator */
/**********************************************************************/
/* Move selected Item by the user. */
/**********************************************************************/
EndToken = strchr(Token,'\xFF');
if(!EndToken)
return FALSE;
*EndToken = 0; /* Set Null Separator */
ORG_MANAGER = atoi(Token);
if (!strlen(Token))
ORG_MANAGER_N = -1;
Token = (EndToken+1); /* Token = EndToken + Separator */
return TRUE;
}
/**********************************************************************/
/* End of Private Function - GetSelBoxListBoxOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: ShowDialogOrg */
/* */
/* Show Window "DialogOrg". */
/* */
/**********************************************************************/
BOOL ShowDialogOrg( PVOID pCrtParms )
{
SWP Swp;
HWND hwndPrevious;
HWND hwndFramePrevious;
BOOL Rc;
/* Save Old Hwnd (Recur). */
hwndFramePrevious = hwndFrameDialogOrg;
hwndPrevious = hwndDialogOrg;
CreateDialogOrg(pCrtParms); /* Create New Window */
WinSetWindowPos( hwndFrameDialogOrg,
NULL,0,0,0,0,SWP_RESTORE);
WinQueryWindowPos( hwndFrameDialogOrg, &Swp );
WinSetWindowPos( hwndFrameDialogOrg,
HWND_TOP,
Swp.x,Swp.y,Swp.cx,Swp.cy,
SWP_ZORDER | SWP_SIZE | SWP_MOVE |
SWP_ACTIVATE | SWP_SHOW
);
Rc = GpfProcessWnd( hwndFrameDialogOrg );
/* Destroy Window */
WinDestroyWindow( hwndFrameDialogOrg );
/* Restore Old Hwnd */
hwndFrameDialogOrg = hwndFramePrevious;
hwndDialogOrg = hwndPrevious;
return(Rc);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: DismissDialogOrg */
/* */
/* Dismiss Window Hide - Window "DialogOrg". */
/* */
/**********************************************************************/
VOID DismissDialogOrg( BOOL Rcode )
{
/* Dismiss Window */
GpfDismissWnd(hwndFrameDialogOrg,Rcode);
}
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CreateDialogOrg */
/* */
/* Create the window "DialogOrg" And Controls. */
/* */
/**********************************************************************/
VOID CreateDialogOrg( PVOID pCrtParms)
{
/********************************************************************/
/* Register the window class "DialogOrg". */
/********************************************************************/
WinRegisterClass( /* Register window class */
habMainTask, /* Anchor block handle */
"DialogOrg", /* Window class name */
fnwpDialogOrg, /* Address window procedure */
CS_CLIPSIBLINGS | CS_SAVEBITS | /* Class style */
CS_MOVENOTIFY | /* Class style */
CS_SIZEREDRAW | CS_SYNCPAINT, /* Class style */
EXTRAWORDS /* Extra window words */
);
/********************************************************************/
/* Create the window "DialogOrg". */
/********************************************************************/
hwndFrameDialogOrg = /* Save Hwnd */
GpfCreateTemplate( ID_DIALOGORG, /* Ressource Id */
hmodSample, /* Ressource Md */
HWND_DESKTOP, /* Hwnd Parent */
HWND_DESKTOP, /* Hwnd Owner */
pCrtParms); /* User Parms */
}
/**********************************************************************/
/* End of Private Function - CreateDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* WinProc: fnwpDialogOrg */
/* */
/* Controls the "DialogOrg" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpDialogOrg(
HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
HPS hps; /* Presentation space handle */
RECTL rcl; /* Window rectangle */
PGPFPARMS pGpfParms; /* Far Pointer */
SEL Selector; /* Seloctor */
/*******************************************************************/
/* Initialize Gpf Parameters */
/*******************************************************************/
pGpfParms = (PGPFPARMS) WinQueryWindowULong(hwnd,QWL_USER);
if (pGpfParms)
{
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->mresult = (MRESULT) FALSE; /* Mresult */
pGpfParms->Command = 0; /* Command From mp1 (SHORT 1) */
pGpfParms->Notify = 0; /* Notify From mp1 (SHORT 2) */
}
switch(msg)
{
/**************************************************************/
/* Things to do when the Window is first initalized */
/**************************************************************/
case WM_INITDLG:
/**************************************************************/
/* Initialize Window 'DialogOrg' */
/**************************************************************/
GpfDefWindowProc( hwnd, msg, mp1, mp2 );
WmInitWndDialogOrg(pGpfParms); /* Init Dialog */
/**************************************************************/
/* Return pGpfParms Mresult */
/**************************************************************/
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is Activated/Deactivated */
/**************************************************************/
case WM_ACTIVATE:
if (SHORT1FROMMP(mp1))
WmActiveDialogOrg(pGpfParms); /* Activate Window */
else
WmDeActiveDialogOrg(pGpfParms); /* DeActivate Window */
return (pGpfParms->mresult);
/**************************************************************/
/* Things to do when the Window is "Show/Hide" */
/**************************************************************/
case WM_SHOW:
if (SHORT1FROMMP(mp1))
WmShowDialogOrg(pGpfParms); /* Show Window */
else
WmHideDialogOrg(pGpfParms); /* Hide Window */
return (pGpfParms->mresult);
/**************************************************************/
/* The application has asked for the window to be created. */
/**************************************************************/
case WM_CREATE:
DosAllocSeg(sizeof(GPFPARMS),&Selector,0); /* Getmain */
pGpfParms = MAKEP(Selector, 0); /* Set Pointer*/
WinSetWindowULong(hwnd,QWL_USER,(ULONG)pGpfParms);
memset(pGpfParms,0,sizeof(GPFPARMS)); /* Clear Area */
pGpfParms->Options |= GPF_OP_ADJUSTSIZE; /* Set AdjustSize */
hwndDialogOrg = hwnd; /* Save Hwnd */
hwndFrameDialogOrg = GpfGetHwndFrame(hwnd);
pGpfParms->hwnd = hwnd; /* window handle */
pGpfParms->msg = msg; /* message number */
pGpfParms->mp1 = mp1; /* 1st (packed) parms */
pGpfParms->mp2 = mp2; /* 2nd (packed) parms */
pGpfParms->hmod = hmodSample;
pGpfParms->hab = habMainTask; /* Anchor block handle */
WmCreateDialogOrg(pGpfParms); /* Create Window */
break;
/**************************************************************/
/* The application has asked for the window to be destroyed. */
/**************************************************************/
case WM_DESTROY:
WmDestroyDialogOrg(pGpfParms); /* Destroy Window */
hwndFrameDialogOrg = (HWND)NULL; /* Reset HwndFrm */
hwndDialogOrg = (HWND)NULL; /* Reset Hwnd */
/* Destroy Template , Help Instance and GpfParms */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* The window needs painting. */
/**************************************************************/
case WM_PAINT:
/**************************************************************/
/* Obtain a cache PS */
/**************************************************************/
hps = WinBeginPaint( hwnd, (HPS)NULL, (PRECTL)&rcl );
WinFillRect(hps,&rcl,pGpfParms->BgColor); /* Fill Rect */
pGpfParms->hps = hps; /* Pass Hps ( Paint ) */
WmPaintDialogOrg(pGpfParms); /* Paint Window */
WinEndPaint( hps ); /* Release cache PS */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process ScrollBar received from the user */
/**************************************************************/
case WM_VSCROLL:
case WM_HSCROLL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp2 */
pGpfParms->Notify = SHORT2FROMMP( mp2 );
CommandDialogOrg( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process Controls received from the user */
/**************************************************************/
case WM_CONTROL:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
/* Set Notify From mp1 */
pGpfParms->Notify = SHORT2FROMMP( mp1 );
CommandDialogOrg( pGpfParms ); /* Process the command */
return (pGpfParms->mresult);
/**************************************************************/
/* Process commands received from the user */
/**************************************************************/
case WM_SYSCOMMAND:
case WM_HELP:
case WM_COMMAND:
/* Set Command From mp1 */
pGpfParms->Command = SHORT1FROMMP( mp1 );
pGpfParms->Notify = COMMAND; /* Set Notify From mp1 */
CommandDialogOrg( pGpfParms ); /* Process the command */
if (pGpfParms->mresult)
return (pGpfParms->mresult);
/* If DID_CANCEL Dismiss Window */
if (pGpfParms->Command == DID_CANCEL)
DismissDialogOrg(FALSE);
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* All other messages are passed to the default procedure. */
/**************************************************************/
default:
/* Pass all other messages to the default window procedure */
return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
}
return ((MRESULT) FALSE);
}
/**********************************************************************/
/* End of window procedure - WinProc: fnwpDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: CommandDialogOrg */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID CommandDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) TRUE; /* Set Return Code */
/* Switch according to Control chosen */
switch( pGpfParms->Command )
{
/******************************************************************/
/* Name "OK2". */
/* Alias "DID_CANCEL". */
/* Text "~Ok". */
/******************************************************************/
case ID_OK2:
case DID_CANCEL:
ActionOK2(pGpfParms);
return;
}
/* Take no action for any other selections */
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: CommandDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* STATIC PRIVATE FUNCTION: ActionOK2 */
/* */
/* Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
/* received by the window procedure. */
/* Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID ActionOK2( PGPFPARMS pGpfParms )
{
/* Switch according to Control chosen */
switch( pGpfParms->Notify )
{
case BN_CLICKED:
case BN_DBLCLICKED:
case COMMAND:
/**************************************************************/
/* Dismiss Window Hide Window "DialogOrg". */
/**************************************************************/
DismissDialogOrg(FALSE);
return;
}
/* Take no action for any other selections */
}
/**********************************************************************/
/* End of Private Function */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDialogOrgToData */
/* */
/* Move "DialogOrg" To Assosiate Data. */
/* */
/**********************************************************************/
BOOL MoveDialogOrgToData ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
/**********************************************************************/
/* Move "ID_DEPTNAME" To "ORG_DEPTNAME". (VARCHAR) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogOrg,
ID_DEPTNAME),
sizeof(ORG_DEPTNAME),
ORG_DEPTNAME);
if (!ORG_DEPTNAME[0]) /* If Null Data */
ORG_DEPTNAME_N = -1; /* Set Sql Null Indicator */
/**********************************************************************/
/* Move "ID_DEPTNUMB" To "ORG_DEPTNUMB". (SMALLINT) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogOrg,
ID_DEPTNUMB),
sizeof(String),
String);
if (!GpfStringIsNumeric(String))
{
WinSetFocus( HWND_DESKTOP,
WinWindowFromID(hwndDialogOrg,ID_DEPTNUMB));
return FALSE;
}
ORG_DEPTNUMB = atoi(String); /* Convert String to Short */
/**********************************************************************/
/* Move "ID_DIVISION" To "ORG_DIVISION". (VARCHAR) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogOrg,
ID_DIVISION),
sizeof(ORG_DIVISION),
ORG_DIVISION);
if (!ORG_DIVISION[0]) /* If Null Data */
ORG_DIVISION_N = -1; /* Set Sql Null Indicator */
/**********************************************************************/
/* Move "ID_LOCATION" To "ORG_LOCATION". (VARCHAR) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogOrg,
ID_LOCATION),
sizeof(ORG_LOCATION),
ORG_LOCATION);
if (!ORG_LOCATION[0]) /* If Null Data */
ORG_LOCATION_N = -1; /* Set Sql Null Indicator */
/**********************************************************************/
/* Move "ID_MANAGER" To "ORG_MANAGER". (SMALLINT) */
/**********************************************************************/
WinQueryWindowText( WinWindowFromID( hwndDialogOrg,
ID_MANAGER),
sizeof(String),
String);
if (!GpfStringIsNumeric(String))
{
WinSetFocus( HWND_DESKTOP,
WinWindowFromID(hwndDialogOrg,ID_MANAGER));
return FALSE;
}
ORG_MANAGER = atoi(String); /* Convert String to Short */
ORG_MANAGER_N = 0; /* Reset Sql Null Indicator*/
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDialogOrgToData */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: MoveDataToDialogOrg */
/* */
/* Move Data To Window "DialogOrg". */
/* */
/**********************************************************************/
BOOL MoveDataToDialogOrg ( VOID )
{
UCHAR String[32];
PUCHAR Token;
String[0] = 0; /* Null, Delete Unreferenced Local variable */
Token = (PUCHAR)NULL; /* Null, Delete Unreferenced Local variable */
/**********************************************************************/
/* Move "ORG_DEPTNAME" To "ID_DEPTNAME". (VARCHAR) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogOrg,
ID_DEPTNAME,
EM_SETTEXTLIMIT,
MPFROMSHORT( sizeof(ORG_DEPTNAME) -1 ),
MPFROMSHORT( NULL ) );
if (ORG_DEPTNAME_N < 0) /* If Null Indicator */
ORG_DEPTNAME[0] = 0; /* Set Null Data */
WinSetWindowText( WinWindowFromID( hwndDialogOrg,
ID_DEPTNAME),
ORG_DEPTNAME);
/**********************************************************************/
/* Move "ORG_DEPTNUMB" To "ID_DEPTNUMB". (SMALLINT) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogOrg,
ID_DEPTNUMB,
EM_SETTEXTLIMIT,
MPFROMSHORT( 5 ),
MPFROMSHORT( NULL ) );
itoa(ORG_DEPTNUMB,String,10); /* Convert to string */
WinSetWindowText( WinWindowFromID( hwndDialogOrg,
ID_DEPTNUMB),
String);
/**********************************************************************/
/* Move "ORG_DIVISION" To "ID_DIVISION". (VARCHAR) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogOrg,
ID_DIVISION,
EM_SETTEXTLIMIT,
MPFROMSHORT( sizeof(ORG_DIVISION) -1 ),
MPFROMSHORT( NULL ) );
if (ORG_DIVISION_N < 0) /* If Null Indicator */
ORG_DIVISION[0] = 0; /* Set Null Data */
WinSetWindowText( WinWindowFromID( hwndDialogOrg,
ID_DIVISION),
ORG_DIVISION);
/**********************************************************************/
/* Move "ORG_LOCATION" To "ID_LOCATION". (VARCHAR) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogOrg,
ID_LOCATION,
EM_SETTEXTLIMIT,
MPFROMSHORT( sizeof(ORG_LOCATION) -1 ),
MPFROMSHORT( NULL ) );
if (ORG_LOCATION_N < 0) /* If Null Indicator */
ORG_LOCATION[0] = 0; /* Set Null Data */
WinSetWindowText( WinWindowFromID( hwndDialogOrg,
ID_LOCATION),
ORG_LOCATION);
/**********************************************************************/
/* Move "ORG_MANAGER" To "ID_MANAGER". (SMALLINT) */
/**********************************************************************/
WinSendDlgItemMsg(hwndDialogOrg,
ID_MANAGER,
EM_SETTEXTLIMIT,
MPFROMSHORT( 5 ),
MPFROMSHORT( NULL ) );
if (ORG_MANAGER_N < 0) /* If Null Indicator */
String[0] = 0; /* Set Null Data */
else
itoa(ORG_MANAGER,String,10); /* Convert to string */
WinSetWindowText( WinWindowFromID( hwndDialogOrg,
ID_MANAGER),
String);
return (TRUE);
}
/**********************************************************************/
/* End of Private Function: MoveDataToDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmInitWndDialogOrg */
/* */
/* Wm Init Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmInitWndDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
/**************************************************************/
/* Center Window "DialogOrg". */
/* Positions Window in the center of the screen */
/**************************************************************/
GpfSetCentreWindow(hwndFrameDialogOrg);
/**************************************************************/
/* Move Data To Window "DialogOrg". */
/**************************************************************/
MoveDataToDialogOrg();
}
/**********************************************************************/
/* End of Private Function: WmInitWndDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmActiveDialogOrg */
/* */
/* Wm Activate Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmActiveDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmActiveDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDeActiveDialogOrg */
/* */
/* DeActivate Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmDeActiveDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDeActiveDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmCreateDialogOrg */
/* */
/* Wm Create Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmCreateDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmCreateDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmDestroyDialogOrg */
/* */
/* Wm Destroy Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmDestroyDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmDestroyDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmPaintDialogOrg */
/* */
/* Wm Paint Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmPaintDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmPaintDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmShowDialogOrg */
/* */
/* Wm Show Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmShowDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmShowDialogOrg */
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: WmHideDialogOrg */
/* */
/* Wm Hide Window "DialogOrg". */
/* */
/**********************************************************************/
static VOID WmHideDialogOrg ( PGPFPARMS pGpfParms )
{
pGpfParms->mresult = (MRESULT) FALSE; /* Set Return Code */
}
/**********************************************************************/
/* End of Private Function: WmHideDialogOrg */
/**********************************************************************/
/**********************************************************************/