Declare Function GetTabbedTextExtent Lib "User32.dll" Alias "GetTabbedTextExtentA" (ByVal hdc As Long, ByVal lpsz As String, ByVal cchString As Long, ByVal nTabPos As Long, ByVal lpnTabStopPos As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hFont As Long) As Long
Declare Function GetStockObject Lib "gdi32" (ByVal fnObject) As Long
Type FieldOptions
Dim CanEdit As Boolean
Dim FieldName As String
Dim MaxLength As Integer
Dim Width As Integer
Dim Caption As String
' METHODS for object: DataBaseFormMaker.FieldOptions
' Initially this code is hard coded for the DataBaseFormMaker
' but this method may be changed for other FormMaker paradigns
If FindObject("DataBaseFormMaker") Then getFormMaker = DataBaseFormMaker Else getFormMaker = Nothing
End Function
Sub SelectFields_ValidateDisplay(ok As Boolean)
If ConfigureFields.Editing Then
Dim YN as New YesNoBox
YN.title = "Editing DATASET with Controls"
YN.message = "WARNING: Editing the order of the fields, or adding or deleting from the SelectedFields will destroy any previous work. Are you sure you want to edit the selected fields list?"
YN.Execute
If YN.result = IDYES Then
DataBaseFormMaker.DestroyControls
Else
SelectFields.BtnNext_Click
Exit Sub
End If
End If
If Not SelectFields.initialized Then
If FormMaker Then
FormMaker.OptionGroup.Clear
With SelectFields
.FillFieldList
.LBSelFields.Clear
If Not Editing Then
FormMaker.ResetTemplates
End If
End With
SelectFields.initialized = True
End If
End If
End Sub
Sub SelectFields_ValidateFinish(ok As Boolean)
If Not Editing Then FormMaker.Go
End Sub
Sub SelectFields_ValidateNext(ok As Boolean)
Dim i as integer
If SelectFields.LBSelFields.ListCount = 0 Then
Dim MBX as New MessageBox
MBX.Message("No Fields", "You must select at least one field to continue")
ok = False
End If
If Not FormMaker Then Throw NoFormMaker
End Sub
Sub SetColors_ValidateDisplay(ok As Boolean)
With SetColors
If Not .initialized Then
FormMaker.ClearColors
.SetColors
.ClearFonts
If Editing then
.SetDefaults
End If
.initialized = True
End If
If Editing then
.BtnCancel.Enabled = False
Else
.BtnCancel.Enabled = True
End If
.LayDisplay
End With
End Sub
Sub SetColors_ValidateFinish(ok As Boolean)
If Not Editing Then FormMaker.Go
End Sub
Sub ConfigText_ValidateDisplay(ok As Boolean)
ConfigText.BtnFinish.Enabled = False
ConfigText.BtnCancel.Enabled = True
' If we're working with a Dynaset, we don't need to configure
' controls
If TypeOf DATASET Is Dynaset Then
ConfigText.NextStep = Nothing
ConfigText.BtnNext.Enabled = False
ConfigText.BtnFinish.Enabled = True
Else
ConfigText.NextStep = Branch
ConfigText.BtnNext.Enabled = True
ConfigText.BtnFinish.Enabled = False
End If
If DATASET.DatabaseType <> "None" Then
If DATASET.Database.FirstLineAsFieldNames = True Then
' Advance the string past the next char, we used it.
I = I + 1
ElseIf tempchar = "^^" Then
' Skip the first character of a "^^" sequence
End If
Else
newstr = newstr & Mid$(oldstr, I, 1)
End If
Next I
ExpandCtrlCharSequences = newstr
End Function
Sub SelectFile_ValidateBack(ok As Boolean)
ConnectString = SelectFile.TBFileName.Text
End Sub
Sub SelectFile_ValidateDisplay(ok As Boolean)
SelectFile.BtnFinish.Enabled = False
SelectFile.BtnCancel.Enabled = True
If Not SelectFile.initialized Then
SelectFile.TBFileName.Clear
SelectFile.initialized = True
End If
SelectFile.TBFileName.Text = ConnectString
SelectFile.TBFileView.Clear
End Sub
Sub SelectFile_ValidateNext(ok As Boolean)
ok = False
If SelectFile.TBFileName.Text = "" Then
InfoBox.Message("Select File", "You must select a file name first")
Exit Sub
End If
ConnectString = SelectFile.TBFileName.Text
ok = True
End Sub
Sub SelectSource_ValidateDisplay(ok As Boolean)
SelectSource.BtnFinish.Enabled = False
SelectSource.BtnCancel.Enabled = True
ok = SelectSource.UpdateListBoxes
End Sub
Sub SelectSource_ValidateNext(ok As Boolean)
Dim SExTrp as New SuspendDebugExceptionTrapping
If SelectSource.CBSource.Text <> "" Then
If Not StrComp(DATASET.Connect, SelectSource.CBSource.Text, 1) = 0 Then
Try
DATASET.Connect = SelectSource.CBSource.Text
ok = True
Catch
MessageBox.Message("Failed to Connect", "Could not connect to DataSource, please verify Connect string and try again")
ok = False
End Try
End If
Else
InfoBox.Message("Need selection", "Please select Data Source before continuing.")
ok = False
End If
End Sub
Sub StartStep_ValidateDisplay(ok As Boolean)
With StartStep
.BtnFinish.Enabled = False
.BtnCancel.Enabled = True
.OBJump.Enabled = CanModify
.BtnWhackLayout.Visible = .OBJump.Enabled
If Not .initialized Then
ConnectString = ""
.OBJump.Value = False
.initialized = True
End If
Select Case DATASET.DatabaseType
Case "ODBC", "None"
.OBODBC.Value = True
Case "DelimitedAscii", "FixedAscii"
If Len(DATASET.Connect) > 0 Then
ConnectString = DATASET.Connect
End If
.OBAscii.Value = True
End Select
' If we can jump, set it as the default
.OBJump.Value = .OBJump.Enabled
' If we can jump, set the appropriate references
If .OBJump.Enabled Then FormMaker.SetReferences(DATASET)
End With
End Sub
Sub StartStep_ValidateNext(ok As Boolean)
With StartStep
If .OBAscii.Value Then
' Place info for Ascii NextStep
.NextStep = SelectFile
End If
If .OBODBC.Value Then
' Place info for ODBC NextStep
.NextStep = SelectSource
End If
If (.OBODBC.Value || .OBAscii.Value) && .OBJump.Enabled then
' We're Editing, but the user DOESN'T want to modify existing layout
Dim YNBX as New YesNoBox
If YNBX.Message("Destroy old layout", "Envelop has already laid out a form based on this Recordset, the layout should be destroyed before altering the Recordset. Do you want to destroy the layout associated with the Recordset?") = IDYES then
FormMaker.DestroyControls
else
ok = False
End If
End If
If .OBJump.Value Then
.NextStep = ConfigureFields
End If
End With
' Change database type if necessary
With DATASET
If StartStep.OBAscii.Value And (.DatabaseType = "ODBC" Or .DatabaseType = "None") Then
' If changing to Ascii, presume delimited
DATASET.DatabaseType = "DelimitedAscii"
ElseIf StartStep.OBODBC.Value And .DatabaseType <> "ODBC" Then
DATASET.DatabaseType = "ODBC"
End If
End With
End Sub
Function TextUnload(ByVal indent As String, cmds As String) As Integer
' Write our parent's properties, but none of ours.
TextUnload = False
End Function
End Type
Begin Code
' Reconstruction commands for object: DatabaseConstants
'
With DatabaseConstants
.DBC_READ_ONLY := 1
.DBC_READ_WRITE := 2
.DBC_LABEL := 3
.DBC_NO_CHANGE := -2
.DBC_ALL := 4
End With 'DatabaseConstants
' Reconstruction commands for object: DataBaseFormMaker
'
With DataBaseFormMaker
.CurrentY := 2175
.Margin := 150
.DBLblFont := Nothing
.DBRWFont := Nothing
.DBROFont := Nothing
.LblBackColor := -1
.LblForeColor := -1
.DBROForeColor := -1
.DBROBackColor := RGB(255, 255, 255)
.DBRWBackColor := -1
.DBRWForeColor := -1
.LabelWidth := 1350
.LabelHeight := 285
.DBROMaxCharWidth := 195
.DBRWMaxCharWidth := 195
.HyperWidth := 8850
With .FieldOptions
.CanEdit := True
.FieldName := ""
.MaxLength := 0
.Width := 0
.Caption := ""
End With 'DataBaseFormMaker.FieldOptions
With .OptionGroup
End With 'DataBaseFormMaker.OptionGroup
With .DefaultFont
.FaceName := "MS Sans Serif"
.Size := 8.000000
.Bold := False
.Italic := False
.Strikethru := False
End With 'DataBaseFormMaker.DefaultFont
End With 'DataBaseFormMaker
' Reconstruction commands for object: QBEDataSourceName
'
With QBEDataSourceName
.Move(3720, 1815, 9075, 4305)
.QueryObject := ODBC
.Processing := 0
.Canceled := 0
With .DataSourceList
.ZOrder := 1
.Move(135, 585, 3480, 1950)
End With 'QBEDataSourceName.DataSourceList
With .CancelBttn
.Caption := "Cancel"
.ZOrder := 2
.Move(6900, 1935, 1830, 600)
End With 'QBEDataSourceName.CancelBttn
With .ConnectButton
.Caption := "Connect"
.ZOrder := 3
.Move(6900, 600, 1830, 600)
End With 'QBEDataSourceName.ConnectButton
With .TablesButton
.Caption := "Browse Tables"
.ZOrder := 4
.Move(6900, 1260, 1830, 600)
End With 'QBEDataSourceName.TablesButton
With .TableList
.ZOrder := 5
.Move(3735, 585, 3150, 1950)
End With 'QBEDataSourceName.TableList
With .ConnectTextBox
.ZOrder := 6
.Move(2085, 3015, 5415, 420)
End With 'QBEDataSourceName.ConnectTextBox
With .ConnectLabel
.Caption := "Connection String:"
.ZOrder := 7
.Move(105, 3075, 1830, 315)
End With 'QBEDataSourceName.ConnectLabel
With .DataSourceLabel
.Caption := "Data Sources"
.ZOrder := 8
.Move(150, 150, 1500, 270)
End With 'QBEDataSourceName.DataSourceLabel
With .TableListLabel
.Caption := "Available Tables"
.ZOrder := 9
.Move(3750, 150, 3000, 270)
End With 'QBEDataSourceName.TableListLabel
End With 'QBEDataSourceName
' Reconstruction commands for object: QBETableData
'
With QBETableData
.Move(4095, 2535, 2040, 1755)
.DB := Nothing
With .FieldsList
.Caption := "FieldsList"
.BackColor := 12632256
.ForeColor := 255
.ZOrder := 2
.Move(0, 360, 1920, 990)
End With 'QBETableData.FieldsList
With .TablesList
.BackColor := 12632256
.ForeColor := 16711808
.ZOrder := 1
.Move(0, 0, 1920, 360)
End With 'QBETableData.TablesList
End With 'QBETableData
' Reconstruction commands for object: PickDatabaseDriver
'
With PickDatabaseDriver
.Caption := "Add Data Source"
.Font := PickDatabaseDriver.EnvelopFont
.Move(4305, 3780, 6030, 3300)
.DefaultButton := PickDatabaseDriver.btnOK
.CancelButton := PickDatabaseDriver.btnCancel
With .btnOK
.Caption := "OK"
.ZOrder := 5
.Move(4515, 150, 1275, 375)
End With 'PickDatabaseDriver.btnOK
With .btnCancel
.Caption := "Cancel"
.ZOrder := 4
.Move(4515, 600, 1275, 375)
End With 'PickDatabaseDriver.btnCancel
With .lbDrivers
.Caption := "lbDrivers"
.ZOrder := 3
.Move(225, 975, 4170, 1785)
End With 'PickDatabaseDriver.lbDrivers
With .Label1
.Caption := "Select which ODBC driver you want to use from the list, then choose OK."
.ZOrder := 2
.Move(225, 75, 3525, 450)
End With 'PickDatabaseDriver.Label1
With .Label2
.Caption := "Installed ODBC &Drivers:"
.ZOrder := 1
.Move(225, 675, 2400, 225)
End With 'PickDatabaseDriver.Label2
With .EnvelopFont
.FaceName := "MS Sans Serif"
.Size := 8.000000
.Bold := True
.Italic := False
.Strikethru := False
End With 'PickDatabaseDriver.EnvelopFont
End With 'PickDatabaseDriver
' Reconstruction commands for object: QBEFieldData
'
With QBEFieldData
.Move(6810, 3510, 2055, 2265)
With .Table
.BackColor := 12632256
.ForeColor := 255
.ZOrder := 5
.Move(0, 0, 1935, 375)
.BorderStyle := "Fixed Single"
.Alignment := "Center"
End With 'QBEFieldData.Table
With .Field
.BackColor := 12632256
.ForeColor := 16711808
.ZOrder := 4
.Move(0, 375, 1935, 330)
.BorderStyle := "Fixed Single"
.Alignment := "Center"
End With 'QBEFieldData.Field
With .SortOrder
.BackColor := 12632256
.ZOrder := 3
.Move(0, 705, 1935, 360)
End With 'QBEFieldData.SortOrder
With .CriteriaAnd
.BackColor := 12632256
.ZOrder := 2
.Move(0, 1065, 1935, 390)
.Alignment := "Center"
End With 'QBEFieldData.CriteriaAnd
With .CriteriaOr
.BackColor := 12632256
.ZOrder := 1
.Move(0, 1455, 1935, 390)
.Alignment := "Center"
End With 'QBEFieldData.CriteriaOr
End With 'QBEFieldData
' Reconstruction commands for object: QBE
'
With QBE
.Move(2805, 4125, 11505, 6150)
.Spacing := 100
.DataConnection := Nothing
.FieldsCount := 0
.TablesCount := 0
With .Execute
.Caption := "Done"
.ZOrder := 5
.Move(10050, 5025, 1125, 345)
End With 'QBE.Execute
With .SQLText
.ZOrder := 6
.Move(735, 4530, 10440, 390)
.WordWrap := True
.MultiLine := True
.ScrollBars := "Vertical"
End With 'QBE.SQLText
With .Dismiss
.Caption := "Cancel"
.ZOrder := 7
.Move(135, 5010, 1110, 345)
End With 'QBE.Dismiss
With .LabelTable
.Caption := "Table :"
.ZOrder := 8
.Move(60, 2265, 630, 210)
.Alignment := "Right"
End With 'QBE.LabelTable
With .LabelField
.Caption := "Field :"
.ZOrder := 9
.Move(60, 2580, 630, 285)
.Alignment := "Right"
End With 'QBE.LabelField
With .LabelSort
.Caption := "Sort :"
.ZOrder := 10
.Move(60, 2955, 630, 255)
.Alignment := "Right"
End With 'QBE.LabelSort
With .LabelAnd
.Caption := "And :"
.ZOrder := 11
.Move(60, 3330, 630, 270)
.Alignment := "Right"
End With 'QBE.LabelAnd
With .LabelOr
.Caption := "Or :"
.ZOrder := 12
.Move(60, 3735, 630, 285)
.Alignment := "Right"
End With 'QBE.LabelOr
With .BuildSql
.Caption := "SQL"
.ZOrder := 13
.Move(120, 4530, 615, 390)
End With 'QBE.BuildSql
With .DeleteTable
.Caption := "Delete"
.ZOrder := 14
.Move(10335, 525, 855, 855)
.BevelOuter := "Raised"
.Picture := QBE.DeleteTable.pict
With .pict
.LoadType := "MemoryBased"
.FileName := "dbtools.ero"
.ResId := 0
End With 'QBE.DeleteTable.pict
End With 'QBE.DeleteTable
With .TablesScroll
.Caption := "TablesScroll"
.ZOrder := 4
.Move(75, 1740, 10230, 285)
.Orientation := "Horizontal"
.Move(75, 1740, 10230, 285)
.OldValue := 0
End With 'QBE.TablesScroll
With .NewTable
.Caption := "New"
.ZOrder := 3
.Move(10335, 105, 855, 345)
End With 'QBE.NewTable
With .TablesContainer
.Caption := "TablesContainer"
.ZOrder := 2
.Move(60, 30, 9825, 1635)
.BorderStyle := "None"
.MaxButton := False
.ControlBox := False
.Parent := QBE
.Visible := True
End With 'QBE.TablesContainer
With .FieldsContainer
.Caption := "FieldsContainer"
.ZOrder := 1
.Move(855, 2160, 10215, 1920)
.BorderStyle := "None"
.MaxButton := False
.ControlBox := False
.Parent := QBE
.Visible := True
End With 'QBE.FieldsContainer
With .FieldsScroll
.Caption := "FieldsScroll"
.ZOrder := 15
.Move(735, 4140, 10440, 285)
.Move(735, 4140, 10440, 285)
End With 'QBE.FieldsScroll
End With 'QBE
' Reconstruction commands for object: DataConConfigureWizard
End With 'DataConConfigureWizard.Branch.ImgGraphic
With .LblInstruction
.Caption := "Would you like to attach existing controls to the dataset, or let Envelop attempt to layout and configure controls. There will be a shortcut to this step from the first page of this wizard in the future."
.ZOrder := 8
.Move(2850, 225, 4065, 1050)
End With 'DataConConfigureWizard.Branch.LblInstruction
End With 'DataConConfigureWizard.SelectFields.LBFieldList
With .LBSelFields
.Caption := "LBSelFields"
.ZOrder := 7
.Move(5550, 1200, 1350, 2370)
.Sorted := False
.IntegralHeight := False
End With 'DataConConfigureWizard.SelectFields.LBSelFields
With .BTNAddAll
.Caption := "Add All ->"
.ZOrder := 6
.Move(4350, 1275, 1050, 450)
End With 'DataConConfigureWizard.SelectFields.BTNAddAll
With .BTNAdd
.Caption := "Add ->"
.ZOrder := 5
.Move(4350, 1875, 1050, 450)
End With 'DataConConfigureWizard.SelectFields.BTNAdd
With .BTNRemove
.Caption := "<- Remove"
.ZOrder := 4
.Move(4350, 2475, 1050, 450)
End With 'DataConConfigureWizard.SelectFields.BTNRemove
With .BTNRemoveAll
.Caption := "<- Clear All"
.ZOrder := 3
.Move(4350, 3075, 1050, 450)
End With 'DataConConfigureWizard.SelectFields.BTNRemoveAll
With .LBLInclude
.Caption := "Selected Fields"
.ZOrder := 2
.Move(5550, 900, 1350, 225)
.Alignment := "Center"
End With 'DataConConfigureWizard.SelectFields.LBLInclude
With .LBLAllFields
.Caption := "Field List"
.ZOrder := 1
.Move(2850, 900, 1350, 225)
.Alignment := "Center"
End With 'DataConConfigureWizard.SelectFields.LBLAllFields
With .BtnFinish
.ZOrder := 9
.Move(6165, 3990, 825, 300)
End With 'DataConConfigureWizard.SelectFields.BtnFinish
With .BtnNext
.ZOrder := 10
.Move(5265, 3990, 825, 300)
End With 'DataConConfigureWizard.SelectFields.BtnNext
With .BtnBack
.Enabled := False
.ZOrder := 11
.Move(4440, 3990, 825, 300)
End With 'DataConConfigureWizard.SelectFields.BtnBack
With .BtnCancel
.ZOrder := 12
.Move(3540, 3990, 825, 300)
End With 'DataConConfigureWizard.SelectFields.BtnCancel
With .ImgGraphic
.ZOrder := 13
.Move(225, 225, 2475, 3150)
.Picture := DataConConfigureWizard.Bitmap
End With 'DataConConfigureWizard.SelectFields.ImgGraphic
With .LblInstruction
.Caption := "Select the fields to include in the layout. The order of the fields in the selected list box will be the order in which the fields will be laid out."
.ZOrder := 14
.Move(2850, 225, 4065, 600)
End With 'DataConConfigureWizard.SelectFields.LblInstruction
With .Frame1
.ZOrder := 15
.Move(75, 3765, 6915, 75)
End With 'DataConConfigureWizard.SelectFields.Frame1
End With 'DataConConfigureWizard.ConfigCtrls.LBControls
With .BTNClearLB
.Caption := "Clear List"
.Move(5550, 1650, 1500, 225)
End With 'DataConConfigureWizard.ConfigCtrls.BTNClearLB
With .LBFields
.Caption := "LBFields"
.ZOrder := 5
.Move(3450, 2475, 3600, 1200)
.Sorted := False
.IntegralHeight := False
End With 'DataConConfigureWizard.ConfigCtrls.LBFields
With .BTNAdd
.Caption := "Add"
.ZOrder := 4
.Move(3975, 2100, 900, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BTNAdd
With .BTNRemove
.Caption := "Remove"
.ZOrder := 3
.Move(4950, 2100, 900, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BTNRemove
With .LBLControls
.Caption := "Controls"
.ZOrder := 14
.Move(2775, 900, 900, 210)
.Alignment := "Center"
End With 'DataConConfigureWizard.ConfigCtrls.LBLControls
With .LBLFields
.Caption := "Fields"
.ZOrder := 2
.Move(2775, 2475, 600, 210)
.Alignment := "Center"
End With 'DataConConfigureWizard.ConfigCtrls.LBLFields
With .DragFeedback
.ZOrder := 1
.Move(2700, 1875, 4350, 225)
End With 'DataConConfigureWizard.ConfigCtrls.DragFeedback
With .BtnFinish
.ZOrder := 7
.Move(6300, 4020, 825, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BtnFinish
With .BtnNext
.Enabled := False
.ZOrder := 8
.Move(5400, 4020, 825, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BtnNext
With .BtnBack
.ZOrder := 9
.Move(4575, 4020, 825, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BtnBack
With .BtnCancel
.Enabled := False
.ZOrder := 10
.Move(3675, 4020, 825, 300)
End With 'DataConConfigureWizard.ConfigCtrls.BtnCancel
With .ImgGraphic
.ZOrder := 11
.Move(225, 225, 2475, 3150)
.Picture := DataConConfigureWizard.Bitmap
End With 'DataConConfigureWizard.ConfigCtrls.ImgGraphic
With .LblInstruction
.Caption := "Select controls and assign fields to them. ^M^J(Add Controls by dragging them with right mouse button onto box below.Be sure form edit is off.)"
.ZOrder := 12
.Move(2850, 150, 4200, 600)
End With 'DataConConfigureWizard.ConfigCtrls.LblInstruction
With .Frame1
.ZOrder := 13
.Move(75, 3795, 7050, 75)
End With 'DataConConfigureWizard.ConfigCtrls.Frame1