VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form C_2TextChoice 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "C_2TextChoice"
   ClientHeight    =   5535
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6405
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5535
   ScaleWidth      =   6405
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton ssp_quit 
      Height          =   615
      Left            =   5700
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4860
      Width           =   615
   End
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   615
      Left            =   4920
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4860
      Width           =   615
   End
   Begin VB.PictureBox Picture3 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   315
      Left            =   0
      ScaleHeight     =   315
      ScaleWidth      =   6195
      TabIndex        =   12
      Top             =   0
      Width           =   6195
      Begin VB.OptionButton rd_Gr1Opt2 
         Caption         =   "rd_Gr1Opt2"
         Height          =   192
         Left            =   3240
         TabIndex        =   14
         Top             =   0
         Visible         =   0   'False
         Width           =   2835
      End
      Begin VB.OptionButton rd_Gr1Opt1 
         Caption         =   "rd_Gr1Opt1"
         Height          =   192
         Left            =   0
         TabIndex        =   13
         Top             =   0
         Value           =   -1  'True
         Visible         =   0   'False
         Width           =   3135
      End
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   3315
      Left            =   60
      ScaleHeight     =   3315
      ScaleWidth      =   6195
      TabIndex        =   5
      Top             =   1380
      Width           =   6195
      Begin VB.TextBox txt_Param2 
         Height          =   1095
         Left            =   0
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   11
         Top             =   2100
         Width           =   6075
      End
      Begin VB.TextBox txt_Param1 
         Height          =   1095
         Left            =   0
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   10
         Top             =   420
         Width           =   6075
      End
      Begin MSForms.ComboBox Cbo_param1 
         Height          =   315
         Left            =   1560
         TabIndex        =   6
         Top             =   0
         Width           =   4515
         VariousPropertyBits=   679479323
         DisplayStyle    =   7
         Size            =   "7964;556"
         MatchEntry      =   1
         ShowDropButtonWhen=   2
         FontHeight      =   165
         FontCharSet     =   0
         FontPitchAndFamily=   2
      End
      Begin MSForms.ComboBox cbo_param2 
         Height          =   315
         Left            =   1620
         TabIndex        =   8
         Top             =   1680
         Width           =   4455
         VariousPropertyBits=   679479323
         DisplayStyle    =   7
         Size            =   "7858;556"
         MatchEntry      =   1
         ShowDropButtonWhen=   2
         FontHeight      =   165
         FontCharSet     =   0
         FontPitchAndFamily=   2
      End
      Begin VB.Label lbl_Param2 
         Caption         =   "lbl_Param2"
         Height          =   255
         Left            =   60
         TabIndex        =   9
         Top             =   1740
         Width           =   1575
      End
      Begin VB.Label lbl_Param1 
         Caption         =   "lbl_Param1"
         Height          =   255
         Left            =   0
         TabIndex        =   7
         Top             =   60
         Width           =   1575
      End
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   735
      Left            =   0
      ScaleHeight     =   735
      ScaleWidth      =   6195
      TabIndex        =   2
      Top             =   360
      Width           =   6195
      Begin VB.OptionButton rd_Gr2Opt3 
         Caption         =   "rd_Gr2Opt3"
         Height          =   192
         Left            =   0
         TabIndex        =   15
         Top             =   480
         Width           =   5955
      End
      Begin VB.OptionButton rd_Gr2Opt1 
         Caption         =   "rd_Gr2Opt1"
         Height          =   192
         Left            =   0
         TabIndex        =   4
         Top             =   0
         Width           =   5895
      End
      Begin VB.OptionButton rd_Gr2Opt2 
         Caption         =   "rd_Gr2Opt2"
         Height          =   192
         Left            =   0
         TabIndex        =   3
         Top             =   240
         Value           =   -1  'True
         Width           =   5715
      End
   End
End
Attribute VB_Name = "C_2TextChoice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public ms_ReqParam1 As String 'request to fill the first combo
Public ms_ReqParam2 As String 'request to fill the second combo
Public ms_ParamReqCsts As String
Public ms_LanguageCode As String ' language code used for the request
Public ms_FillDefaultReqParam1 As String ' request to fill initial values
Public ms_FillDefaultReqParam2 As String ' request to fill initial values
Public ms_Param1iconcurrency As String
Public ms_Param2iconcurrency As String
Public ms_Param1Code As String
Public ms_Param2Code As String
Public ms_Param1Text As String ' first text  choosen
Public ms_Param2Text As String ' second text chosen
Public mi_Option1Chosen As Integer 'number of the radio button chosen
Public mi_Option2Chosen As Integer
Public ms_Option2Desc As String
Public mb_Return  As Boolean 'OK if the user click on the save button

Private Sub FillDefaultValue()
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Param1Code As String
Dim ls_Param1Desc As String
Dim ls_Param2Code As String
Dim ls_Param2Desc As String
        
    ms_Param1iconcurrency = "0"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ms_FillDefaultReqParam1) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    Do While li_Status = SQL_SUCCESS Or _
             li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or _
           li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Param1Code = ODBCData(ll_Statement, 1)
            ls_Param1Desc = ODBCMemoGet(ll_Statement, 2)
            ms_Param1iconcurrency = ODBCData(ll_Statement, 3)
            MCombo_AddItemCode Cbo_param1, ls_Param1Code, ls_Param1Desc
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    
    
    ms_Param2iconcurrency = "0"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ms_FillDefaultReqParam2) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    Do While li_Status = SQL_SUCCESS Or _
             li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or _
           li_Status = SQL_SUCCESS_WITH_INFO Then
            
            ls_Param2Code = ODBCData(ll_Statement, 1)
            ls_Param2Desc = ODBCMemoGet(ll_Statement, 2)
            ms_Param2iconcurrency = ODBCData(ll_Statement, 3)
            MCombo_AddItemCode cbo_param2, ls_Param2Code, ls_Param2Desc
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
    
suite:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub



Private Sub ReadConstants()
'------------------------------------------------------------------
' Name : ReadConstants()
'
' Purpose : Create if needed screen constants in a file
'
'
' review : Nov/23/1999 by JJB
'------------------------------------------------------------------

'initialize the different temporary files
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field, ls_Text As String

    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ms_ParamReqCsts) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Field = ODBCData(ll_Statement, 1)
            ls_Text = ODBCData(ll_Statement, 2)
            Select Case ls_Field
                Case "Title": Caption = ls_Text
                Case "rd_Gr1Opt1": rd_Gr1Opt1.Caption = ls_Text
                Case "rd_Gr1Opt2": rd_Gr1Opt2.Caption = ls_Text
                Case "rd_Gr2Opt1": rd_Gr2Opt1.Caption = ls_Text
                Case "rd_Gr2Opt2": rd_Gr2Opt2.Caption = ls_Text
                Case "rd_Gr2Opt3": rd_Gr2Opt3.Caption = ls_Text
                Case "lbl_Param1": lbl_Param1.Caption = ls_Text
                Case "lbl_Param2": lbl_Param2.Caption = ls_Text
            End Select
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
suite:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub Cbo_param1_Click()
    txt_Param1.Text = Cbo_param1.value
End Sub

Private Sub Cbo_param1_DropButtonClick()
Dim ls_Req As String
Dim l_ActualCode
    
    If Cbo_param1.Tag = UNLOADED Then
        MouseOff
    
        l_ActualCode = MCombo_GetCode(Cbo_param1)
        Cbo_param1.Clear
        MCombo_AddItemCode Cbo_param1, 0, ""
    
        ls_Req = ms_ReqParam1 & ms_LanguageCode & "'"
        MCombo_Fill Cbo_param1, ls_Req
            
        MCombo_CodeSelect(Cbo_param1) = l_ActualCode
        
        Cbo_param1.Tag = Loaded
        
        MouseOn
    End If
End Sub

Private Sub cbo_param2_Click()
    txt_Param2.Text = cbo_param2.value
End Sub

Private Sub cbo_param2_DropButtonClick()
Dim ls_Req As String
Dim l_ActualCode
    
    If cbo_param2.Tag = UNLOADED Then
        MouseOff
    
        l_ActualCode = MCombo_GetCode(cbo_param2)
        cbo_param2.Clear
        MCombo_AddItemCode cbo_param2, 0, ""
        
        ls_Req = ms_ReqParam2 & ms_LanguageCode & "'"
        MCombo_Fill cbo_param2, ls_Req
            
        MCombo_CodeSelect(cbo_param2) = l_ActualCode
        
        cbo_param2.Tag = Loaded
        
        MouseOn
    End If
End Sub

Private Sub Form_Load()
    'On Error GoTo suite
    
    MouseOff
    
    If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

    mb_Return = KO
    spp_save.Picture = LoadResPicture(RES_OK, 1)
    ssp_quit.Picture = LoadResPicture(RES_QUIT, 1)
    Cbo_param1.Tag = UNLOADED
    cbo_param2.Tag = UNLOADED
    mi_Option1Chosen = 0
    ms_Param1Text = ""
    ms_Param2Text = ""
    ms_Param1Code = ""
    ms_Param2Code = ""
    
    
    Call ReadConstants
    Call FillDefaultValue
    
    MouseOn
End Sub

Private Sub spp_save_Click()
    If rd_Gr1Opt1.value = OK Then
        mi_Option1Chosen = 1
    Else
        mi_Option1Chosen = 2
    End If
    If rd_Gr2Opt1.value = OK Then
        mi_Option2Chosen = 1
        ms_Option2Desc = rd_Gr2Opt1.Caption
    Else
        If rd_Gr2Opt2.value = OK Then
            mi_Option2Chosen = 2
            ms_Option2Desc = rd_Gr2Opt2.Caption
        Else
            mi_Option2Chosen = 3
            ms_Option2Desc = rd_Gr2Opt3.Caption
        End If
    End If
    
    ms_Param1Text = txt_Param1.Text
    ms_Param2Text = txt_Param2.Text
    ms_Param1Code = MCombo_GetCode(Cbo_param1)
    ms_Param2Code = MCombo_GetCode(cbo_param2)
    mb_Return = OK
    Unload Me
End Sub

Private Sub ssp_quit_Click()
    Unload Me
End Sub
