home *** CD-ROM | disk | FTP | other *** search
- Save Format v1.3
- @begin Form "WinText"
- Exported 0;
-
- @begin Object "WDialog"
- WSCaption 1;
- WSSizeable 1;
- WSDlgBorder 1;
- WSSysMenu 1;
- WSSystemMenu 1;
- WSMinimizeBox 1;
- WSMaximizeBox 1;
- WSGroup 1;
- WSTabStop 1;
- WSResizeBorder 1;
- WSVisible 1;
- FormPositionType "Centered";
- FormAbsTop "259";
- FormAbsLeft "197";
- FDXStructName "WinTextFDXStruct";
- Font "8.MS Sans Serif";
- Text "Intersolv Text File Example";
- @begin Event "Create"
- GencodeSrcLine 228;
- FunctionName "WinText::WinText_Create";
- @end;
- @begin UserFunction "WinText()"
- Compiler 1;
- GencodeSrcLine 242;
- FunctionName "WinText::WinText()";
- @end;
- @begin UserFunction "~WinText()"
- Compiler 1;
- GencodeSrcLine 246;
- FunctionName "WinText::~WinText()";
- @end;
- @begin UserFunction "Process( WWindow *parent )"
- GencodeSrcLine 250;
- FunctionName "WinText::Process( WWindow *parent )";
- @end;
- @begin UserFunction "Prototype for Process( WWindow *parent )"
- Private 1;
- GencodeSrcLine 66;
- FunctionName "WinText::Prototype for Process( WWindow *parent )";
- @end;
- ResID 108;
- DesignName WinText;
- TabIndex 0;
- DesignRect 212,108,217,90;
- @end;
-
- @begin Object "WQuery"
- BindLimit "0";
- ConcurrencyLevel "WQCLLock";
- CursorType "WQCTDynamic";
- SQL "select * from text.txt\r\norder by Employee";
- Transaction "WinText::transaction_text";
- AutoOpen "0";
- ResID 101;
- DesignName query_text;
- TabIndex 0;
- DesignRect 6,57,19,17;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSMinimizeBox 1;
- WSGroup 1;
- WSVisible 1;
- AutoSize "1";
- Text "Employee:";
- ResID 102;
- DesignName label_1;
- TabIndex 0;
- DesignRect 6,12,33,8;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Employee";
- DataSource "WinText::query_text";
- FDXFieldName "textb_1_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 103;
- DesignName textb_1;
- TabIndex 1;
- DesignRect 56,12,145,12;
- @end;
-
- @begin Object "WTransaction"
- DataSource "Text File Optima Example";
- AutoConnect "0";
- ResID 104;
- DesignName transaction_text;
- TabIndex 2;
- DesignRect 26,57,19,17;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Start date:";
- ResID 105;
- DesignName label_2;
- TabIndex 2;
- DesignRect 6,27,30,8;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "StartDate";
- DataSource "WinText::query_text";
- FDXFieldName "textb_2_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 106;
- DesignName textb_2;
- TabIndex 3;
- DesignRect 56,27,145,12;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Salary:";
- ResID 107;
- DesignName label_3;
- TabIndex 4;
- DesignRect 6,42,21,8;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Salary";
- DataSource "WinText::query_text";
- FDXFieldName "textb_3_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 108;
- DesignName textb_3;
- TabIndex 5;
- DesignRect 56,42,145,12;
- @end;
-
- @begin Object "WDataNavigator"
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- BOFAction "WDNActionMoveFirst";
- DataSource "WinText::query_text";
- EOFAction "WDNActionMoveLast";
- ShowAdd "1";
- ShowCancel "1";
- ShowDelete "1";
- ShowEdit "1";
- ShowMoveFirst "1";
- ShowMoveLast "1";
- ShowMoveNext "1";
- ShowMovePrevious "1";
- ShowRefresh "1";
- ShowUpdate "1";
- ResID 109;
- DesignName datanavigator_1;
- TabIndex 6;
- DesignRect 56,62,147,12;
- @end;
-
- @begin HPPPrefixBlock
- @begin-code HPPPrefix
-
- // Declarations added here will be included at the top of the .HPP file
-
- @end-code;
- GencodeSrcLine 13;
- @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 "odbcadm.hpp"
- #include "applic.hpp"
-
-
-
- static WChar *Driver_keys[]={
- WTEXT( "Description" ), WTEXT( "" ),
- WTEXT( "ScanRows" ), WTEXT( "25" ),
- WTEXT( "FileOpenCache" ), WTEXT( "0" ),
- WTEXT( "CacheSize" ), WTEXT( "4" ),
- WTEXT( "IntlSort" ), WTEXT( "0" ),
- WTEXT( "UseLongQualifiers" ), WTEXT( "0" ),
- WTEXT( "TableType" ), WTEXT( "Character" ),
- WTEXT( "Delimiter" ), WTEXT( "#" ),
- WTEXT( "UndefinedTable" ), WTEXT( "GUESS" ),
- WTEXT( "ExtraExtensions" ), WTEXT( "" ),
- WTEXT( "DataFileExtension" ), WTEXT( "TXT" ),
- WTEXT( "FirstLineNames" ), WTEXT( "1" ),
- NULL
- };
-
- static WChar Driver[]=
- WTEXT( "INTERSOLV OEM 2.12 32-BIT Text (*.*)" );
-
- static WChar Datasource[]= WTEXT( "Text File Optima Example" );
-
- @end-code;
- GencodeSrcLine 10;
- @end;
-
- @begin ClassContentsBlock
- @begin-code ClassContents
-
- public:
- // add your public instance data here
- private:
- // add your private instance data here
- WString _dbpath;
-
- protected:
- // add your protected instance data here
-
- @end-code;
- GencodeSrcLine 58;
- @end;
-
- @begin-code GeneratedClassContents
-
- WinText();
- ~WinText();
-
- @end-code;
-
- @begin-code Code "WinText::WinText()"
-
- WinText::WinText()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinText::~WinText()"
-
- WinText::~WinText()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinText::Process( WWindow *parent )"
-
- WBool WinText::Process( WWindow *parent )
- {
- WString driver_dll;
- WStringArray keys;
- int i;
- WString db_file;
- WFilePath path;
- WString dir;
-
- if( !ODBCAdmin::DriverExists( Driver, driver_dll ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Driver Error",
- "The ODBC Driver '%s' is not installed. Data source cannot "
- "be created.", Driver );
- return( FALSE );
- }
-
- for( i = 0; Driver_keys[i] != NULL; ++i );
- keys.SetCount( i + 4 );
- for( i = 0; Driver_keys[i] != NULL; ++i ) {
- keys[i] = Driver_keys[i];
- }
- keys[i] = WTEXT( "Driver" );
- keys[i + 1] = driver_dll;
- keys[i + 2] = WTEXT( "Database" );
- db_file = Application->GetProgramPath();
- path = db_file;
- dir = path.GetDirectory();
- dir.Concat( "\\.." );
- path.SetFileName( "" );
- path.SetDirectory( dir );
- path.CleanDirectory();
- keys[i + 3] = path;
- _dbpath = path;
-
- if( !ODBCAdmin::AddDataSource( Datasource, Driver, keys ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Data source Error",
- "The ODBC Datasource '%s' could not be installed", Datasource );
- return( FALSE );
- }
-
- Create( parent );
-
- return( TRUE );
- }
-
- @end-code;
-
- @begin-code Code "WinText::Prototype for Process( WWindow *parent )"
-
- public:
- WBool Process( WWindow *parent );
-
- @end-code;
-
- @begin-code Code "WinText::WinText_Create"
-
- WBool WinText::WinText_Create(
- WObject * source,
- WCreateEventData * event )
- {
- WString connect_parms;
-
- connect_parms.Sprintf( "database=%s", _dbpath.GetText() );
- transaction_text->SetConnectParams( connect_parms );
- transaction_text->Connect();
- query_text->Open();
- query_text->MoveFirst();
-
- return FALSE;
- }
-
- @end-code;
- @end;
-