home *** CD-ROM | disk | FTP | other *** search
Wrap
Save Format v1.3 @begin Form "Form_Customers" Exported 0; @begin Object "WModelessDialog" WSCaption 1; WSSizeable 1; WSDlgBorder 1; WSSysMenu 1; WSSystemMenu 1; WSMinimizeBox 1; WSMaximizeBox 1; WSGroup 1; WSTabStop 1; WSResizeBorder 1; WSVisible 1; StatusBar "StatusBarAtBottom"; Icon "WIcon( WResourceID( ICON_CUSTOMER ) )"; FormPositionType "Centered"; FormAbsTop "108"; FormAbsLeft "125"; FDXStructName "Form_CustomersFDXStruct"; Font "8.MS Sans Serif"; Text "Customers"; @begin Event "Create" GencodeSrcLine 172; FunctionName "Form_Customers::Form_Customers_Create"; @end; @begin Event "Destroy" GencodeSrcLine 187; FunctionName "Form_Customers::Form_Customers_Destroy"; @end; @begin UserFunction "Form_Customers()" Compiler 1; GencodeSrcLine 197; FunctionName "Form_Customers::Form_Customers()"; @end; @begin UserFunction "~Form_Customers()" Compiler 1; GencodeSrcLine 201; FunctionName "Form_Customers::~Form_Customers()"; @end; @begin UserFunction "Open( WForm * parent )" GencodeSrcLine 205; FunctionName "Form_Customers::Open( WForm * parent )"; @end; @begin UserFunction "Prototype for Open( WForm * parent )" Private 1; GencodeSrcLine 69; FunctionName "Form_Customers::Prototype for Open( WForm * parent )"; @end; @begin UserFunction "customerEdit( WLong index )" Private 1; GencodeSrcLine 213; FunctionName "Form_Customers::customerEdit( WLong index )"; @end; @begin UserFunction "Prototype for customerEdit( WLong index )" Private 1; GencodeSrcLine 71; FunctionName "Form_Customers::Prototype for customerEdit( WLong index )"; @end; @begin UserFunction "customerNew( void )" Private 1; GencodeSrcLine 241; FunctionName "Form_Customers::customerNew( void )"; @end; @begin UserFunction "Prototype for customerNew( void )" Private 1; GencodeSrcLine 73; FunctionName "Form_Customers::Prototype for customerNew( void )"; @end; @begin UserFunction "customerDelete( WLong index )" Private 1; GencodeSrcLine 254; FunctionName "Form_Customers::customerDelete( WLong index )"; @end; @begin UserFunction "Prototype for customerDelete( WLong index )" Private 1; GencodeSrcLine 75; FunctionName "Form_Customers::Prototype for customerDelete( WLong index )"; @end; @begin UserFunction "Refresh( void )" GencodeSrcLine 273; FunctionName "Form_Customers::Refresh( void )"; @end; @begin UserFunction "Prototype for Refresh( void )" Private 1; GencodeSrcLine 77; FunctionName "Form_Customers::Prototype for Refresh( void )"; @end; @begin UserFunction "menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )" Private 1; GencodeSrcLine 281; FunctionName "Form_Customers::menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )"; @end; @begin UserFunction "Prototype for menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )" Private 1; GencodeSrcLine 79; FunctionName "Form_Customers::Prototype for menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )"; @end; ResID 102; DesignName Form_Customers; TabIndex 0; DesignRect 102,57,292,166; @end; @begin Menu ItemCount 3; DesignName "menu_Main"; IsDefault 1; ResID 101; DesignRect 25,105,19,17; @begin Popup Name "Customer"; Caption "&Customer"; NegotiatePosition None; @begin Item Name "CustomerNew"; Caption "&New..."; ResID 1001; NegotiatePosition None; @begin Event "Click" GencodeSrcLine 308; FunctionName "Form_Customers::menu_Main_CustomerNew_Click"; @end; @end; @begin Item Name "CustomerEdit"; Caption "&Edit..."; ResID 1002; NegotiatePosition None; @begin Event "Click" GencodeSrcLine 300; FunctionName "Form_Customers::menu_Main_CustomerEdit_Click"; @end; @end; @begin Item Name "CustomerDelete"; Caption "&Delete..."; ResID 1003; NegotiatePosition None; @begin Event "Click" GencodeSrcLine 292; FunctionName "Form_Customers::menu_Main_CustomerDelete_Click"; @end; @end; Separator ; @begin Item Name "CustomerSort"; Caption "&Sort Descending"; ResID 1005; NegotiatePosition None; @begin Event "Click" GencodeSrcLine 316; FunctionName "Form_Customers::menu_Main_CustomerSort_Click"; @end; @end; @end; @end; @begin Object "WQuery" BindLimit "0"; CursorType "WQCTDynamic"; SQL "SELECT customer.id AS \"ID\", customer.lname AS \"Last Name\", customer.fname AS \"First Name\", customer.company_name AS \"Company\"\r\nFROM \"DBA\".\"customer\" AS customer\r\n"; AutoRefresh "0"; AutoEdit "0"; Transaction "Form_Main::transaction_OrderEntry"; AutoOpen "0"; ResID 102; DesignName query_Customers; TabIndex 1; DesignRect 0,105,19,17; @end; @begin Object "WListView" WLVSReport 1; WLVSSingleSelection 1; WLVSShareImageLists 1; WCCSTop 1; WCCSNoResize 1; WCCSNoDivider 1; WSChild 1; WSMinimizeBox 1; WSMaximizeBox 1; WSGroup 1; WSTabStop 1; WSVisible 1; DataKeptRows "30"; DataColumns "ID;\"Last Name\";\"First Name\";Company;"; DataGuardRows "5"; DataSource "Form_Customers::query_Customers"; ToolTipText "Click with the right mouse button for a context menu"; @begin Event "ColumnClick" GencodeSrcLine 324; FunctionName "Form_Customers::lv_Customers_ColumnClick"; @end; @begin Event "DoubleClick" GencodeSrcLine 333; FunctionName "Form_Customers::lv_Customers_DoubleClick"; @end; ResID 103; DesignName lv_Customers; TabIndex 2; DesignRect 0,0,285,100; @end; @begin HPPPrefixBlock @begin-code HPPPrefix // Declarations added here will be included at the top of the .HPP file #include "ViewHelper.hpp" @end-code; GencodeSrcLine 11; @end; @begin CPPPrefixBlock @begin-code CPPPrefix // Code added here will be included at the top of the .CPP file // Include definitions for resources. #include "WRes.h" #include "Form_CustomerDetail.hpp" @end-code; GencodeSrcLine 10; @end; @begin ClassContentsBlock @begin-code ClassContents public: // add your public instance data here private: // add your private instance data here ViewHelper _view; protected: // add your protected instance data here @end-code; GencodeSrcLine 62; @end; @begin-code GeneratedClassContents Form_Customers(); ~Form_Customers(); @end-code; @begin-code Code "Form_Customers::Form_Customers()" Form_Customers::Form_Customers() : _view( this, (ViewCreateFunction)&Form_Customers::Create ) { } @end-code; @begin-code Code "Form_Customers::~Form_Customers()" Form_Customers::~Form_Customers() { } @end-code; @begin-code Code "Form_Customers::Open( WForm * parent )" // Open // Public interface to load and open the customer list. WBool Form_Customers::Open( WForm * parent ) { return( _view.Open(parent) ); } @end-code; @begin-code Code "Form_Customers::Prototype for Open( WForm * parent )" public: WBool Open( WForm * parent ); @end-code; @begin-code Code "Form_Customers::customerEdit( WLong index )" // customerEdit // index is the selected record in lv_Customers // The customer ids are in the first column // The detail window is modeless, and frees its own memory. // It calls the Refresh() method of this class to cause the // list view to be updated after a refresh. WBool Form_Customers::customerEdit( WLong index ) { WBool ret = FALSE; Form_CustomerDetail * detail; WLong id; WString idText; if( index >= 0 ) { idText = lv_Customers->GetText( index, 0 ); id = idText.GetLong(); detail = new Form_CustomerDetail; if( detail ) { detail->Edit( this, id ); } } return( ret ); } @end-code; @begin-code Code "Form_Customers::Prototype for customerEdit( WLong index )" private: WBool customerEdit( WLong index ); @end-code; @begin-code Code "Form_Customers::customerNew( void )" WBool Form_Customers::customerNew( void ) { WBool ret = FALSE; Form_CustomerDetail * detail; detail = new Form_CustomerDetail; if( detail ) { detail->New( this ); } return( ret ); } @end-code; @begin-code Code "Form_Customers::Prototype for customerNew( void )" private: WBool customerNew( void ); @end-code; @begin-code Code "Form_Customers::customerDelete( WLong index )" WBool Form_Customers::customerDelete( WLong index ) { WBool ret = FALSE; Form_CustomerDetail * detail; WLong id; WString idText; if( index >= 0 ) { idText = lv_Customers->GetText( index, 0 ); id = idText.GetLong(); detail = new Form_CustomerDetail; if( detail ) { detail->Delete( this, id ); } } return( ret ); } @end-code; @begin-code Code "Form_Customers::Prototype for customerDelete( WLong index )" private: WBool customerDelete( WLong index ); @end-code; @begin-code Code "Form_Customers::Refresh( void )" // Refresh // Refresh the information in the listview after an update. void Form_Customers::Refresh( void ) { _view.Refresh(); } @end-code; @begin-code Code "Form_Customers::Prototype for Refresh( void )" public: void Refresh( void ); @end-code; @begin-code Code "Form_Customers::menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )" WBool Form_Customers::menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event ) { WBool selected; // Enable/disable items to match selected state of the list view selected = lv_Customers->Retrieve() >= 0; menu_Main_CustomerEdit->SetEnabled( selected ); menu_Main_CustomerDelete->SetEnabled( selected ); return FALSE; } @end-code; @begin-code Code "Form_Customers::Prototype for menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event )" private: WBool menu_Main_Customer_InitPopupMenu( WObject * source, WEventData * event ); @end-code; @begin-code Code "Form_Customers::Form_Customers_Create" WBool Form_Customers::Form_Customers_Create( WObject * source, WCreateEventData * event ) { WBool result; result = _view.Create( lv_Customers, query_Customers ); // Set the context menu for the listview. Use the same menu as the menu bar. lv_Customers->SetPopup( menu_Main_Customer ); WEventHandler func = (WEventHandler)&Form_Customers::menu_Main_Customer_InitPopupMenu; menu_Main_Customer->SetEventHandler( WInitPopupMenuEvent, this, func ); return result; } @end-code; @begin-code Code "Form_Customers::Form_Customers_Destroy" WBool Form_Customers::Form_Customers_Destroy( WObject * source, WEventData * event ) { WBool result; result = _view.Destroy(); return result; } @end-code; @begin-code Code "Form_Customers::menu_Main_CustomerDelete_Click" WBool Form_Customers::menu_Main_CustomerDelete_Click( WObject * source, WEventData * event ) { customerDelete( lv_Customers->Retrieve() ); return TRUE; } @end-code; @begin-code Code "Form_Customers::menu_Main_CustomerEdit_Click" WBool Form_Customers::menu_Main_CustomerEdit_Click( WObject * source, WEventData * event ) { customerEdit( lv_Customers->Retrieve() ); return TRUE; } @end-code; @begin-code Code "Form_Customers::menu_Main_CustomerNew_Click" WBool Form_Customers::menu_Main_CustomerNew_Click( WObject * source, WEventData * event ) { customerNew(); return TRUE; } @end-code; @begin-code Code "Form_Customers::menu_Main_CustomerSort_Click" WBool Form_Customers::menu_Main_CustomerSort_Click( WObject * source, WEventData * event ) { menu_Main_CustomerSort->SetText( _view.ToggleSortOrder() ); return FALSE; } @end-code; @begin-code Code "Form_Customers::lv_Customers_ColumnClick" WBool Form_Customers::lv_Customers_ColumnClick( WObject * source, WListViewEventData * event ) { _view.SortList( event->subItemNumber+1 ); return FALSE; } @end-code; @begin-code Code "Form_Customers::lv_Customers_DoubleClick" WBool Form_Customers::lv_Customers_DoubleClick( WObject * source, WListViewEventData * event ) { customerEdit( lv_Customers->Retrieve() ); return FALSE; } @end-code; @end;