VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Memo_mtnc 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   5565
   ClientLeft      =   285
   ClientTop       =   885
   ClientWidth     =   8805
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   5565
   ScaleWidth      =   8805
   Begin VB.Frame ssp_Command 
      BackColor       =   &H80000009&
      BorderStyle     =   0  'None
      Height          =   612
      Left            =   120
      TabIndex        =   15
      Top             =   0
      Width           =   1692
      Begin VB.PictureBox pic_delete 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   600
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   18
         Top             =   120
         Visible         =   0   'False
         Width           =   384
      End
      Begin VB.PictureBox pic_add 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         DragIcon        =   "MEMO.frx":0000
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   120
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   17
         Top             =   120
         Visible         =   0   'False
         Width           =   384
      End
      Begin VB.PictureBox pic_upd 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         DragIcon        =   "MEMO.frx":030A
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   1080
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   16
         Top             =   120
         Visible         =   0   'False
         Width           =   384
      End
   End
   Begin MSComctlLib.ImageList img_pictList 
      Left            =   3660
      Top             =   4920
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin VB.TextBox txt_Comment 
      Height          =   912
      Left            =   3180
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   4
      Top             =   1920
      Width           =   5532
   End
   Begin VB.TextBox txt_English 
      Height          =   1332
      Left            =   3180
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   12
      Top             =   3300
      Width           =   5532
   End
   Begin VB.TextBox txt_Type 
      Height          =   288
      Left            =   6540
      Locked          =   -1  'True
      TabIndex        =   11
      Top             =   720
      Visible         =   0   'False
      Width           =   2172
   End
   Begin VB.TextBox txt_Title 
      Height          =   285
      Left            =   3180
      MaxLength       =   100
      TabIndex        =   3
      Top             =   1320
      Width           =   5535
   End
   Begin VB.Frame fra_Comment 
      Height          =   4455
      Left            =   120
      TabIndex        =   2
      Top             =   720
      Width           =   2835
      Begin MSComctlLib.TreeView tvw_memo 
         Height          =   4095
         Left            =   120
         TabIndex        =   14
         Top             =   240
         Width           =   2595
         _ExtentX        =   4577
         _ExtentY        =   7223
         _Version        =   393217
         Style           =   5
         BorderStyle     =   1
         Appearance      =   0
      End
   End
   Begin VB.ComboBox cbo_TypeCode 
      Height          =   315
      Left            =   7980
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   720
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.ComboBox cbo_Type 
      Height          =   315
      Left            =   6540
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   720
      Width           =   2172
   End
   Begin VB.CommandButton SSP_Ok 
      Height          =   612
      Left            =   6780
      Style           =   1  'Graphical
      TabIndex        =   10
      Top             =   4800
      Visible         =   0   'False
      Width           =   612
   End
   Begin VB.CommandButton SSP_Quit 
      Height          =   612
      Left            =   8100
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   4800
      Width           =   612
   End
   Begin VB.CommandButton SSP_Cancel 
      Height          =   612
      Left            =   7440
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   4800
      Visible         =   0   'False
      Width           =   612
   End
   Begin VB.Label lbl_English 
      Caption         =   "English version"
      Height          =   255
      Left            =   3180
      TabIndex        =   13
      Top             =   3060
      Width           =   5535
   End
   Begin VB.Label Lbl_title 
      Caption         =   "Title"
      Height          =   255
      Left            =   3180
      TabIndex        =   7
      Top             =   1080
      Width           =   5535
   End
   Begin VB.Label Lbl_comm 
      Caption         =   "Comment"
      Height          =   255
      Left            =   3180
      TabIndex        =   6
      Top             =   1680
      Width           =   5535
   End
   Begin VB.Label lbl_Type 
      Caption         =   "Type of memo"
      Height          =   255
      Left            =   6540
      TabIndex        =   5
      Top             =   480
      Width           =   2175
   End
End
Attribute VB_Name = "Memo_mtnc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ms_MemoDatas() As String
Dim ms_Lang() As String
Dim mi_NumOfType As Integer
Dim mi_NumOfLang As Integer
Dim ms_Action As String
Dim mi_ActualLine As Integer
Dim mb_Flag As Boolean


Private Sub Def_Icons()
If tvw_memo.SelectedItem Is Nothing Then Exit Sub

Dim i As Integer
Dim j As Integer

pic_add.Visible = KO
pic_delete.Visible = KO
pic_upd.Visible = KO
ssp_Command.Visible = False

'mi_ActualLine = 0
'While ms_Lang(0, mi_ActualLine) <> tlst_Memo.ItemStrValue(tlst_Memo.ListIndex)
'While ms_Lang(0, mi_ActualLine) <> Mid(tvw_memo.SelectedItem.Key, 4)
'    mi_ActualLine = mi_ActualLine + 1
'Wend
'debug.assert (tvw_memo.SelectedItem.Key Like "_0_*")
mi_ActualLine = Mid(tvw_memo.SelectedItem.Key, 4)
If ms_Lang(1, mi_ActualLine) = "1" Then
    If mi_ActualLine = 0 Then
        For i = 0 To mi_NumOfType - 1
            If ms_MemoDatas(2, i) = "" And ms_Lang(1, mi_ActualLine) = "1" Then
                pic_add.Visible = OK
                ssp_Command.Visible = True
            End If
        Next i
    Else
        j = 0
        For i = (mi_ActualLine * mi_NumOfType) To ((mi_ActualLine + 1) * mi_NumOfType - 1)
            If ms_MemoDatas(2, j) <> "" And ms_MemoDatas(2, i) = "" And ms_Lang(1, mi_ActualLine) = "1" Then
                pic_add.Visible = OK
                ssp_Command.Visible = True
            End If
            j = j + 1
        Next i
    End If
End If

End Sub

Private Sub Def_Icons2()
If tvw_memo.SelectedItem Is Nothing Then Exit Sub

Dim i As Integer
Dim j As Integer

ssp_Command.Visible = True
pic_add.Visible = KO
If ms_Lang(1, mi_ActualLine) = "1" Then
    pic_delete.Visible = OK
    pic_upd.Visible = OK
    
    If gut_LangWork.Code = "E" Then
        i = 0
        If gut_Param.Str2 = "" Then
'            While (ms_MemoDatas(4, i) <> tlst_Memo.Text)
'                i = i + 1
'            Wend
            'debug.assert (tvw_memo.SelectedItem.Key Like "_1_*")
            i = Mid(tvw_memo.SelectedItem.Key, 4)
            For j = 1 To mi_NumOfLang - 1
                If ms_MemoDatas(2, (j * mi_NumOfType) + i) <> "" Then
                    pic_delete.Visible = KO
                End If
            Next j
        Else
            While (ms_MemoDatas(0, i) <> tvw_memo.SelectedItem.Text)
                i = i + 1
            Wend
            For j = 1 To mi_NumOfLang - 1
                If ms_MemoDatas(2, (j * mi_NumOfType) + i) <> "" Then
                    pic_delete.Visible = KO
                End If
            Next j
        End If
    End If
Else
    pic_delete.Visible = KO
    pic_upd.Visible = KO
End If
ssp_Command.Visible = pic_delete.Visible Or pic_upd.Visible

End Sub



Private Sub Fill_MemoDatas()
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Lang As String
Dim ls_Type As String
Dim i As Integer

On Error GoTo suite

ls_Req = gut_Param.Str5 & " '" & gut_Param.Str1 & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) 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
        If gut_Param.Str2 = "" Then
            ls_Lang = ODBCData(ll_Statement, 1)
            ls_Type = ODBCData(ll_Statement, 2)
            i = 0
            While (ms_MemoDatas(0, i) <> ls_Type) Or (ms_MemoDatas(1, i) <> ls_Lang)
                i = i + 1
            Wend
            ms_MemoDatas(2, i) = ODBCData(ll_Statement, 3)
            ms_MemoDatas(3, i) = ODBCMemoGet(ll_Statement, 4)
            ms_MemoDatas(4, i) = ODBCData(ll_Statement, 5)
            ms_MemoDatas(5, i) = ODBCData(ll_Statement, 6)
        Else
            ls_Lang = ODBCData(ll_Statement, 1)
            i = 0
            While (ms_MemoDatas(1, i) <> ls_Lang)
                i = i + 1
            Wend
            ms_MemoDatas(2, i) = ODBCData(ll_Statement, 2)
            ms_MemoDatas(3, i) = ODBCMemoGet(ll_Statement, 3)
            ms_MemoDatas(4, i) = ODBCData(ll_Statement, 4)
        End If
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
StdError
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub

Private Sub Fill_Tlst()
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
ReDim ms_Lang(3, 0) As String
Dim i As Integer

On Error GoTo suite

ls_Req = "EXEC memo_flag_lst '" & gs_TableName & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) 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
        i = i + 1
        ReDim Preserve ms_Lang(3, i)
'        tlst_Memo.AddItem ""
        ms_Lang(2, i - 1) = ODBCData(ll_Statement, 1)
'        tlst_Memo.Image(i - 1) = LoadResPicture(CInt(ms_Lang(2, i - 1)), 1)
        ms_Lang(1, i - 1) = ODBCData(ll_Statement, 2)
        ms_Lang(0, i - 1) = ODBCData(ll_Statement, 3)
        
        Call InsertNode(tvw_memo, "", "_0_" & (i - 1), "", _
                        CInt(ms_Lang(2, i - 1)), CInt(ms_Lang(2, i - 1)), , vbResIcon)
        
        
'        tlst_Memo.ItemStrValue(i - 1) = ms_Lang(0, i - 1)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
mi_NumOfLang = i
Exit Sub

suite:
Select Case Err
    Case 326:
'        tlst_Memo.Image(tlst_Memo.ListCount - 1) = LoadResPicture(999, 1)
        Resume
    Case Else:
        StdError
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Select
End Sub
Private Sub Fill_Cbo_Type()
If gut_Param.Str2 <> "" Then
    txt_Type = gut_Param.Str2
    mi_NumOfType = 1
Else
    cbo_TypeCode.Clear
    cbo_Type.Clear
    FillCbo gut_Param.Str3, cbo_TypeCode, cbo_Type
    mi_NumOfType = cbo_Type.ListCount
End If
End Sub

Private Sub Fill_Tlst2()
Dim i As Integer
Dim j As Integer
'Dim k As Integer
'Dim l As Integer
Dim lo_ParentNode As MSComctlLib.Node

On Error GoTo suite

Call tvw_memo.Nodes.Clear
'tlst_Memo.Clear
'debug.assert (mi_NumOfLang = UBound(ms_Lang, 2))
For i = 0 To mi_NumOfLang - 1
    Call InsertNode(tvw_memo, "", "_0_" & i, "", _
                    CInt(ms_Lang(2, i)), CInt(ms_Lang(2, i)), , vbResIcon)
'    tlst_Memo.AddItem ""
'    tlst_Memo.Image(i) = LoadResPicture(CInt(ms_Lang(2, i)), 1)
'    tlst_Memo.ItemStrValue(i) = ms_Lang(0, i)
Next i

'k = 0
For i = 0 To mi_NumOfLang - 1
    Set lo_ParentNode = GetNode(tvw_memo, "_0_" & i)
'    l = 0
    For j = 0 To mi_NumOfType - 1
        If ms_MemoDatas(2, (i * mi_NumOfType) + j) <> "" Then
'            tlst_Memo.ListIndex = k
            If gut_Param.Str2 = "" Then
                Call InsertNode(tvw_memo, lo_ParentNode.Key, "_1_" & ((i * mi_NumOfType) + j), ms_MemoDatas(4, (i * mi_NumOfType) + j))
'                tlst_Memo.AddItem ms_MemoDatas(4, (i * mi_NumOfType) + j), k
            Else
                Call InsertNode(tvw_memo, lo_ParentNode.Key, "_1_" & ((i * mi_NumOfType) + j), txt_Type)
'                tlst_Memo.AddItem txt_Type, k
            End If
            lo_ParentNode.Expanded = True
'            l = l + 1
        End If
    Next j
'    k = k + l + 1
Next i
Exit Sub

suite:
Select Case Err
    Case 326:
        ' put special icon when specified not found
'        tlst_Memo.Image(tlst_Memo.ListCount - 1) = LoadResPicture(999, 1)
        Resume
    Case Else:
        StdError
End Select
End Sub

Private Sub Init_Controls()
ssp_Command.Visible = False
pic_add.Visible = KO
pic_upd.Visible = KO
pic_delete.Visible = KO
lbl_type.Visible = KO
txt_Type.Visible = KO
cbo_Type.Visible = KO
txt_Title = ""
txt_comment = ""
lbl_Title.Visible = KO
txt_Title.Visible = KO
Lbl_comm.Visible = KO
txt_comment.Visible = KO
SSP_Ok.Visible = KO
SSP_Cancel.Visible = KO
cbo_Type.ListIndex = -1
lbl_English.Visible = KO
txt_English.Visible = KO
txt_comment.Height = 2712
End Sub

Private Sub Init_MemoDatas()
Dim i As Integer
Dim j As Integer

If gut_Param.Str2 = "" Then
    ReDim ms_MemoDatas(6, mi_NumOfLang * mi_NumOfType)
    For i = 0 To mi_NumOfLang - 1
        For j = 0 To mi_NumOfType - 1
            ms_MemoDatas(0, (i * mi_NumOfType) + j) = cbo_TypeCode.List(j)
            ms_MemoDatas(1, (i * mi_NumOfType) + j) = ms_Lang(0, i)
            ms_MemoDatas(2, (i * mi_NumOfType) + j) = ""
            ms_MemoDatas(3, (i * mi_NumOfType) + j) = ""
            ms_MemoDatas(4, (i * mi_NumOfType) + j) = ""
            ms_MemoDatas(5, (i * mi_NumOfType) + j) = ""
        Next j
    Next i
Else
    For j = 0 To mi_NumOfLang - 1
        ReDim Preserve ms_MemoDatas(5, j + 1)
        ms_MemoDatas(0, j) = txt_Type
        ms_MemoDatas(1, j) = ms_Lang(0, j)
        ms_MemoDatas(2, j) = ""
        ms_MemoDatas(3, j) = ""
        ms_MemoDatas(4, j) = ""
    Next j
End If
End Sub

Private Sub Validate_AddMemo()
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
   
On Error GoTo suite

If gut_Param.Str2 = "" Then
    ls_Req = gut_Param.Str4 & " '" & gut_Param.Str1 & "','" _
        & ms_Lang(0, mi_ActualLine) & "','" _
        & cbo_TypeCode.List(cbo_Type.ListIndex) & "','" _
        & QuoteParam(txt_Title) & "','" _
        & QuoteParam(txt_comment) & "'"
Else
    ls_Req = gut_Param.Str4 & " '" & gut_Param.Str1 & "','" & ms_Lang(0, mi_ActualLine) & "','" & QuoteParam(txt_Title) & "','" & QuoteParam(txt_comment) & "'"
End If

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQL_SUCCESS
    gb_Return = OK
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

Private Function Validate_DelMemo() As Boolean
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim i As Integer

On Error GoTo suite

Validate_DelMemo = KO

If SendMessage(5, "Delete record ?", gut_LangLogin.Code, vbQuestion + vbYesNo, "Delete ") = vbYes Then
    i = 0
    If gut_Param.Str2 = "" Then
        While (ms_MemoDatas(1, i) <> gut_LangWork.Code) Or (ms_MemoDatas(4, i) <> cbo_Type)
            i = i + 1
        Wend
        ls_Req = gut_Param.Str6 & " '" & gut_Param.Str1 & "','" _
            & gut_LangWork.Code & "','" _
            & cbo_TypeCode.List(cbo_Type.ListIndex) & "'," _
            & ms_MemoDatas(5, i)
    Else
        While (ms_MemoDatas(1, i) <> gut_LangWork.Code)
            i = i + 1
        Wend
        ls_Req = gut_Param.Str6 & " '" & gut_Param.Str1 & "','" _
            & gut_LangWork.Code & "'," _
            & ms_MemoDatas(4, i)
    End If
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        If ll_lngrows = 0 Then
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            SendMessage 7, "Delete failed : concurrency problem ?", gut_LangLogin.Code
        Else
            Validate_DelMemo = OK
            gb_Return = OK
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 6, "Delete failed", gut_LangLogin.Code
    End If
    Exit Function
End If
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function

Private Function Validate_UpdMemo() As Boolean
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim i As Integer

On Error GoTo suite

Validate_UpdMemo = KO

i = 0
If gut_Param.Str2 = "" Then
    While (ms_MemoDatas(1, i) <> gut_LangWork.Code) Or (ms_MemoDatas(4, i) <> cbo_Type)
        i = i + 1
    Wend
    ls_Req = gut_Param.Str7 & " '" & gut_Param.Str1 & "','" _
        & gut_LangWork.Code & "','" _
        & cbo_TypeCode.List(cbo_Type.ListIndex) & "','" _
        & QuoteParam(txt_Title) & "','" _
        & QuoteParam(txt_comment) & "'," _
        & ms_MemoDatas(5, i)
Else
    While (ms_MemoDatas(1, i) <> gut_LangWork.Code)
        i = i + 1
    Wend
    Select Case gs_TableName
    Case "ProductsFamilies_Group", "AccProductsFamilies_Group"
        ls_Req = gut_Param.Str7 & " " & gut_Param.Str1 & ",'" _
            & gut_LangWork.Code & "','" _
            & QuoteParam(txt_Title) & "','" _
            & QuoteParam(txt_comment) & "'," _
            & ms_MemoDatas(4, i)
    Case Else
        ls_Req = gut_Param.Str7 & " '" & gut_Param.Str1 & "','" _
            & gut_LangWork.Code & "','" _
            & QuoteParam(txt_Title) & "','" _
            & QuoteParam(txt_comment) & "'," _
            & ms_MemoDatas(4, i)
    End Select
End If

    
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
    If ll_lngrows = 0 Then
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 2, "Another user change the record", gut_LangLogin.Code
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        Validate_UpdMemo = OK
        gb_Return = OK
    End If
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    SendMessage 3, "Update failed", gut_LangLogin.Code
End If
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Sub Cbo_type_Click()
Dim i As Integer
Dim j As Integer

MouseOff
If cbo_Type.ListIndex <> -1 Then
    txt_Title = ""
    txt_comment = ""
    If ms_Action = "add" Then
        'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
'        If tlst_Memo.ListIndex = 0 Then
        If tvw_memo.SelectedItem.Key = "_0_0" Then
            If ms_MemoDatas(2, cbo_Type.ListIndex) <> "" Then
                SendMessage 75, "This memo already exists", gut_LangLogin.Code
                MouseOn
                Exit Sub
            End If
        Else
            If ms_MemoDatas(2, cbo_Type.ListIndex) = "" Then
                SendMessage 48, "You must fill the memo in english first", gut_LangLogin.Code
                MouseOn
                Exit Sub
            End If
            If ms_MemoDatas(2, (mi_NumOfType * mi_ActualLine) + cbo_Type.ListIndex) <> "" Then
                SendMessage 75, "This memo already exists", gut_LangLogin.Code
                MouseOn
                Exit Sub
            End If
        End If
        lbl_Title.Visible = OK
        txt_Title.Visible = OK
        If mi_ActualLine = 0 Then
            lbl_English.Visible = KO
            txt_English.Visible = KO
            txt_comment.Height = 2712
        Else
            lbl_English.Visible = OK
            txt_English.Visible = OK
            txt_comment.Height = 1332
            txt_English = ms_MemoDatas(2, cbo_Type.ListIndex) _
                & Chr(13) & Chr(10) & ms_MemoDatas(3, cbo_Type.ListIndex)
        End If
    End If
    pic_add.Visible = KO
    pic_delete.Visible = KO
    pic_upd.Visible = KO
End If
MouseOn
End Sub
Private Sub Fill_Text()
Dim i As Integer

i = 0
While (ms_MemoDatas(1, i) <> gut_LangWork.Code) Or (ms_MemoDatas(4, i) <> cbo_Type)
    i = i + 1
Wend
txt_Title = ms_MemoDatas(2, i)
txt_comment = ms_MemoDatas(3, i)
End Sub

Private Sub get_sc_csts()
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field As String
Dim ls_Text As String

On Error GoTo suite

ls_Req = "EXEC Screen_Csts 'memo','" & QuoteParam(gut_LangLogin.Code) & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) 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 "lbl_memo": Lbl_comm = ls_Text
            Case "lbl_title": lbl_Title = ls_Text
            Case "lbl_type": lbl_type = ls_Text
            Case "lbl_english": lbl_English = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
StdError
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub

Private Sub Form_Activate()
   
' If tlst_Memo.Indent(1) = 1 Then
'    tlst_Memo.Selected(1) = True
'    tlst_Memo_Click
' Else
'    tlst_Memo.Selected(0) = True
'    tlst_Memo_PictureClick
'End If

 If tvw_memo.Nodes(1).children > 0 Then
    Set tvw_memo.SelectedItem = tvw_memo.Nodes(1).Child
    Call tvw_memo_Click
 Else
    Set tvw_memo.SelectedItem = tvw_memo.Nodes(1)
    Call clickNodeLevel0(tvw_memo.SelectedItem)
End If

End Sub

Private Sub Form_Load()
MouseOff

If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

pic_add.Picture = LoadResPicture(RES_ADD, 1)
pic_upd.Picture = LoadResPicture(RES_MODIFY, 1)
pic_delete.Picture = LoadResPicture(RES_DELETE, 1)
SSP_Cancel.Picture = LoadResPicture(RES_CANCEL, 1)
SSP_Ok.Picture = LoadResPicture(RES_OK, 1)
ssp_quit.Picture = LoadResPicture(RES_QUIT, 1)

    ' NEW remove TreeView begin
    Call InitImageList(img_pictList)
    Call InitTreeView(tvw_memo, img_pictList)
    ' NEW remove TreeView end

get_sc_csts
Fill_Tlst

' set first item
'debug.assert (tvw_memo.Nodes.Count > 0)
Set tvw_memo.SelectedItem = tvw_memo.Nodes(1)

'tlst_Memo.ListIndex = 0
Init_Controls
Fill_Cbo_Type
Init_MemoDatas
Fill_MemoDatas
Fill_Tlst2



MouseOn
End Sub

Private Sub pic_add_Click()
MouseOff

tvw_memo.Enabled = False

txt_Type.Locked = KO
txt_Title.Locked = KO
txt_comment.Locked = KO
cbo_Type.Enabled = OK
SSP_Cancel.Visible = OK
If gut_Param.Str2 <> "" Then
    txt_Title = ""
    txt_comment = ""
    If tvw_memo.SelectedItem.Key = "_0_0" Then
'    If tlst_Memo.ListIndex = 0 Then
        If ms_MemoDatas(2, 0) <> "" Then
            SendMessage 75, "This memo already exists", gut_LangLogin.Code
            MouseOn
            Exit Sub
        End If
    Else
        If ms_MemoDatas(2, 0) = "" Then
            SendMessage 48, "You must fill the memo in english first", gut_LangLogin.Code
            MouseOn
            Exit Sub
        End If
        If ms_MemoDatas(2, (mi_NumOfType * mi_ActualLine)) <> "" Then
            SendMessage 75, "This memo already exists", gut_LangLogin.Code
            MouseOn
            Exit Sub
        End If
    End If
    lbl_Title.Visible = OK
    txt_Title.Visible = OK
    Lbl_comm.Visible = OK
    txt_comment.Visible = OK
    SSP_Ok.Visible = OK
    txt_Title.SetFocus
    
    If mi_ActualLine = 0 Then
        lbl_English.Visible = KO
        txt_English.Visible = KO
        txt_comment.Height = 2712
    Else
        lbl_English.Visible = OK
        txt_English.Visible = OK
        txt_comment.Height = 1332
        txt_English = ms_MemoDatas(2, 0) _
            & Chr(13) & Chr(10) & ms_MemoDatas(3, 0)
    End If
    pic_add.Visible = KO
    pic_delete.Visible = KO
    pic_upd.Visible = KO
Else
    lbl_type.Visible = OK
    cbo_Type.Visible = OK
End If
ms_Action = "add"
pic_add.Visible = KO
ssp_Command.Visible = pic_add.Visible Or pic_delete.Visible Or pic_upd.Visible

MouseOn
End Sub

'Private Sub CheckTBVisibility(ByVal aToolbar As SSPanel)
Private Sub CheckTBVisibility(ByVal aToolbar As VB.Frame)

End Sub


Private Sub pic_delete_Click()
MouseOff
ms_Action = "delete"
pic_delete.Visible = KO
pic_upd.Visible = KO
SSP_Cancel.Visible = KO
SSP_Ok.Visible = OK
ssp_Command.Visible = pic_add.Visible Or pic_delete.Visible Or pic_upd.Visible
tvw_memo.Enabled = False
MouseOn
End Sub

Private Sub pic_upd_Click()
MouseOff
txt_Title.Locked = KO
txt_comment.Locked = KO
ms_Action = "upd"
pic_delete.Visible = KO
pic_upd.Visible = KO
SSP_Cancel.Visible = OK
SSP_Ok.Visible = OK
If mi_ActualLine = 0 Then
    lbl_English.Visible = KO
    txt_English.Visible = KO
    txt_comment.Height = 2712
Else
    lbl_English.Visible = OK
    txt_English.Visible = OK
    txt_comment.Height = 1332
    
    If gut_Param.Str2 = "" Then
    txt_English = ms_MemoDatas(2, cbo_Type.ListIndex) _
        & Chr(13) & Chr(10) & ms_MemoDatas(3, cbo_Type.ListIndex)
    Else
        txt_English = ms_MemoDatas(2, 0) _
            & Chr(13) & Chr(10) & ms_MemoDatas(3, 0)
    End If

End If


ssp_Command.Visible = pic_add.Visible Or pic_delete.Visible Or pic_upd.Visible
txt_Title.SelStart = 0
txt_Title.SelLength = Len(txt_Title.Text)
txt_Title.SetFocus
tvw_memo.Enabled = False
MouseOn
End Sub

Private Sub SSP_Cancel_Click()
MouseOff
    
 Select Case ms_Action
    Case "add"
        pic_add_Click
    Case "upd"
        Call tvw_memo_Click
'        tlst_Memo_Click
        pic_upd_Click
 End Select
    
'    If tlst_Memo.Indent(tlst_Memo.ListIndex) = 0 Then
'        tlst_Memo_PictureClick
'    Else
'        tlst_Memo_Click
'    End If
MouseOn
End Sub



Private Sub SSP_Ok_Click()
Dim ls_Line As String

MouseOff
gb_Return = KO
Select Case ms_Action
Case "add"
    If Trim(txt_comment) = "" Then
        txt_comment = txt_Title
    End If
    Validate_AddMemo
    'ces commandes permettent de mettre a jour le c_main dans l'ancienne methode.
'    If gb_Return Then
'        Select Case gs_TableName
''        Case "Surfaces_Memo"
''            C_main.Grid.RemoveItem C_main.Grid.Row
''            ls_Line = gs_TableCode & Chr(9) & 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
''            C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        Case "Products_Edges_Memo"
'            C_main.Grid.RemoveItem C_main.Grid.Row
'            ls_Line = gs_TableCode & Chr(9) & 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
'            C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        End Select
'    End If
    Dim newNode As MSComctlLib.Node
    
    If gut_Param.Str2 = "" Then
        ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = txt_Title
        ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = txt_comment
        ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = cbo_Type
        ms_MemoDatas(5, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = "1"
        Set newNode = InsertNode(tvw_memo, tvw_memo.SelectedItem.Key, "_1_" & (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex, cbo_Type.Text)
'        tlst_Memo.AddItem cbo_Type, tlst_Memo.ListIndex
        Init_Controls
    Else
        ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType)) = txt_Title
        ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType)) = txt_comment
        ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType)) = "1"
        
        'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
        'debug.assert (tvw_memo.SelectedItem.Key Like "_0_*")
        Set newNode = InsertNode(tvw_memo, tvw_memo.SelectedItem.Key, "_1_" & (mi_ActualLine * mi_NumOfType), txt_Type.Text)
'        tlst_Memo.AddItem txt_Type, tlst_Memo.ListIndex
        Init_Controls
'        tlst_Memo.Selected(tlst_Memo.ListIndex + 1) = True
        Set tvw_memo.SelectedItem = newNode
        Call tvw_memo_Click
    End If
Case "delete"
    If Validate_DelMemo Then
        If gut_Param.Str2 = "" Then
            ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = ""
            ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = ""
            ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = ""
            ms_MemoDatas(5, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = ""
            
            'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
            ' ensure that selected item is one that we are about to delete
            'debug.assert (tvw_memo.SelectedItem.Key = "_1_" & ((mi_ActualLine * mi_NumOfType) + cbo_type.ListIndex))
            
            tvw_memo.Nodes.Remove (tvw_memo.SelectedItem.Key)
'            tlst_Memo.RemoveItem tlst_Memo.ListIndex
            Init_Controls
        Else
            ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType)) = ""
            ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType)) = ""
            ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType)) = ""
            ms_MemoDatas(5, (mi_ActualLine * mi_NumOfType)) = ""
            
            'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
            ' ensure that selected item is one that we are about to delete
            'debug.assert (tvw_memo.SelectedItem.Key = "_1_" & (mi_ActualLine * mi_NumOfType))
            
            Dim lo_ParentNode As MSComctlLib.Node
            Set lo_ParentNode = tvw_memo.SelectedItem.Parent
            
            tvw_memo.Nodes.Remove (tvw_memo.SelectedItem.Key)
'            tlst_Memo.RemoveItem tlst_Memo.ListIndex
            Init_Controls
            
            Set tvw_memo.SelectedItem = lo_ParentNode
            Call clickNodeLevel0(tvw_memo.SelectedItem)
'            tlst_Memo.Selected(tlst_Memo.ListIndex - 1) = True
'            Call tlst_Memo_PictureClick

        End If
'        Select Case gs_TableName
'            Case "Surfaces_Memo"
'                C_main.Grid.RemoveItem C_main.Grid.Row
'                ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 + 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
'                C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        Case "Products_Edges_Memo"
'            C_main.Grid.RemoveItem C_main.Grid.Row
'            ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 + 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
'            C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        End Select
    End If
Case "upd"
    If Trim(txt_comment) = "" Then
        txt_comment = txt_Title
    End If
    If Validate_UpdMemo Then
        If gut_Param.Str2 = "" Then
            ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = txt_Title
            ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = txt_comment
            ms_MemoDatas(5, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex) = CInt(ms_MemoDatas(5, (mi_ActualLine * mi_NumOfType) + cbo_Type.ListIndex)) + 1
            
            ' ensure that selected item is one that we are about to delete
            'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
            'debug.assert (tvw_memo.SelectedItem.Key = "_1_" & ((mi_ActualLine * mi_NumOfType) + cbo_type.ListIndex))
            Call tvw_memo_Click
        Else
            ms_MemoDatas(2, (mi_ActualLine * mi_NumOfType)) = txt_Title
            If Trim(txt_comment) = "" Then
                txt_comment = txt_Title
            End If
            ms_MemoDatas(3, (mi_ActualLine * mi_NumOfType)) = txt_comment
            ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType)) = CInt(ms_MemoDatas(4, (mi_ActualLine * mi_NumOfType))) + 1
            
            ' ensure that selected item is one that we are about to delete
            'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
            'debug.assert (tvw_memo.SelectedItem.Key = "_1_" & (mi_ActualLine * mi_NumOfType))
            Call tvw_memo_Click
'            tlst_Memo_Click
        End If
        
'        Select Case gs_TableName
'        Case "Surfaces_Memo"
'            C_main.Grid.RemoveItem C_main.Grid.Row
'            ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 + 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
'            C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        Case "Products_Edges_Memo"
'            C_main.Grid.RemoveItem C_main.Grid.Row
'            ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 + 1 & Chr(9) & gs_TableCode3 & Chr(9) & txt_Title & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7
'            C_main.Grid.AddItem ls_Line, C_main.Grid.Row
'        End Select
    End If
End Select
tvw_memo.Enabled = True
MouseOn
End Sub
Private Sub ssp_quit_Click()
    Select Case ms_Action
        Case "add", "upd", "delete"
            ms_Action = ""
'            tlst_Memo.Enabled = True
'            tlst_Memo_Click
            tvw_memo.Enabled = True
            Call tvw_memo_Click
        Case Else
            Unload Me
    End Select
End Sub


'Private Sub txt_Title_Change()
'MouseOff
'If mb_Flag = KO Then
'    If txt_Title <> "" Then
'        Lbl_comm.Visible = OK
'        txt_Comment.Visible = OK
'        SSP_Ok.Visible = OK
'    Else
'        Lbl_comm.Visible = KO
'        txt_Comment.Visible = KO
'        SSP_Ok.Visible = KO
'    End If
'End If
'txt_Title.Visible = OK
'txt_Title.SetFocus
'MouseOn
'End Sub

' NEW remove TreeView begin
Private Function InsertNode(ByVal ao_tvw As MSComctlLib.TreeView, ByVal ao_parentKey As String, ByVal as_Key As String, ByVal as_Text As String, Optional ByVal al_image As Long = -1, Optional ByVal al_imageSel As Long = -1, Optional ByVal al_relationship As MSComctlLib.TreeRelationshipConstants = tvwChild, Optional ByVal al_imageType As LoadResConstants = vbResIcon) As MSComctlLib.Node
    Dim lo_retNode As MSComctlLib.Node
    Set lo_retNode = GetNode(ao_tvw, as_Key)
    If lo_retNode Is Nothing Then
        Set lo_retNode = ao_tvw.Nodes.Add(IIf(ao_parentKey = "", Null, ao_parentKey), _
                                          al_relationship, _
                                          as_Key, _
                                          as_Text, _
                                          GetImageIndex(ao_tvw.ImageList, al_image, al_imageType), _
                                          GetImageIndex(ao_tvw.ImageList, al_imageSel, al_imageType))
    End If
    Set InsertNode = lo_retNode
End Function

Private Function GetNode(ByVal ao_tvw As MSComctlLib.TreeView, ByVal as_Key As String) As MSComctlLib.Node
    Dim lo_Node As MSComctlLib.Node
    
    Set GetNode = Nothing
    For Each lo_Node In ao_tvw.Nodes
        If lo_Node.Key = as_Key Then
            Set GetNode = lo_Node
            Exit For
        End If
    Next
End Function

Private Function GetImageIndex(ByVal ao_imageList As MSComctlLib.ImageList, ByVal al_resIndex As Long, ByVal al_resType As LoadResConstants) As Variant
    If (ao_imageList Is Nothing) Or (al_resIndex = -1) Then
        GetImageIndex = Empty
        Exit Function
    End If
    
    Dim lo_image As MSComctlLib.ListImage
    For Each lo_image In ao_imageList.ListImages
        If lo_image.Key = "_" & al_resIndex Then
            GetImageIndex = lo_image.Index
            Exit Function
        End If
    Next
    
    GetImageIndex = LoadImage(ao_imageList, al_resIndex, al_resType)
End Function

Private Function LoadImage(ByVal ao_imageList As MSComctlLib.ImageList, ByVal al_resIndex As Long, ByVal al_resType As LoadResConstants) As Long
    Dim lo_image As MSComctlLib.ListImage
    Set lo_image = ao_imageList.ListImages.Add(, "_" & al_resIndex, LoadResPicture(al_resIndex, al_resType))
    LoadImage = lo_image.Index
End Function

Private Sub InitTreeView(ByRef ao_tvw As MSComctlLib.TreeView, Optional ByVal ao_imgList As MSComctlLib.ImageList = Nothing)
    ao_tvw.HideSelection = False        ' don't hide selection when lostFocus
    ao_tvw.LineStyle = tvwRootLines ' tvwTreeLines
    ao_tvw.LabelEdit = tvwManual        ' disable edit labels
    ao_tvw.Indentation = 50
    ao_tvw.FullRowSelect = True         ' special setting
    Set ao_tvw.ImageList = ao_imgList
End Sub

Private Sub InitImageList(ByRef ao_imgList As MSComctlLib.ImageList)
    ao_imgList.ImageHeight = 32
    ao_imgList.ImageWidth = 32
    ao_imgList.MaskColor = vbMagenta

    ' at least one image must be loaded to correctly initialize imagelist
    Call LoadImage(ao_imgList, RES_OPENFOLDER, vbResBitmap)
    
End Sub
' NEW remove TreeView end

Private Sub tvw_memo_NodeClick(ByVal Node As MSComctlLib.Node)
    Call tvw_memo_Click
End Sub

Private Sub tvw_memo_Click()
'debug.assert (Not tvw_memo.SelectedItem Is Nothing)
Dim i As Integer
Dim j As Integer
Dim k As Integer

MouseOff
Init_Controls
mb_Flag = OK
ms_Action = "MoreInfo"
If tvw_memo.SelectedItem.Key Like "_1_*" Then
    'debug.assert (Not tvw_memo.SelectedItem.Parent Is Nothing)
    mi_ActualLine = Mid(tvw_memo.SelectedItem.Parent.Key, 4)
    gut_LangWork.Code = ms_Lang(0, mi_ActualLine)
    
    If gut_Param.Str2 = "" Then
'    If tlst_Memo.Text <> "" Then
        ' this is only for level 1 ( when we don't have text in node )
'        i = tlst_Memo.ListIndex
'        j = tlst_Memo.Indent(tlst_Memo.ListIndex)
'        k = i
'        While tlst_Memo.Indent(k) = j
'            k = k - 1
'        Wend
'        gut_LangWork.Code = tlst_Memo.ItemStrValue(k)
'        i = 0
'        While ms_Lang(0, i) <> gut_LangWork.Code
'            i = i + 1
'        Wend
'        mi_ActualLine = i
        
        Fill_Cbo_Type
        cbo_Type = tvw_memo.SelectedItem.Text 'tlst_Memo.Text
        Fill_Text
        If gut_Param.Str8 = "1" Then
            Def_Icons2
        End If
    Else
'    If tlst_Memo.Text <> "" Then
        ' this is only for level 1 ( when we don't have text in node )
'        i = tlst_Memo.ListIndex
'        j = tlst_Memo.Indent(tlst_Memo.ListIndex)
'        k = i
'        While tlst_Memo.Indent(k) = j
'            k = k - 1
'        Wend
'        gut_LangWork.Code = tlst_Memo.ItemStrValue(k)
'        i = 0
'        While ms_Lang(0, i) <> gut_LangWork.Code
'            i = i + 1
'        Wend
'        mi_ActualLine = i
        
        txt_Title.Visible = OK
        txt_comment.Visible = OK
        txt_Title = ms_MemoDatas(2, mi_ActualLine)
        txt_comment = ms_MemoDatas(3, mi_ActualLine)
        If gut_Param.Str8 = "1" Then
            Def_Icons2
        End If
    End If
'End If
'If tlst_Memo.Indent(tlst_Memo.ListIndex) = 1 Then
    If gut_Param.Str2 = "" Then
        lbl_type.Visible = OK
        cbo_Type.Visible = OK
    End If
    lbl_Title.Visible = OK
    txt_Title.Visible = OK
    Lbl_comm.Visible = OK
    txt_comment.Visible = OK
    txt_Type.Locked = OK
    cbo_Type.Enabled = KO
    txt_Title.Locked = OK
    txt_comment.Locked = OK
Else
    Call clickNodeLevel0(tvw_memo.SelectedItem)
'    tlst_Memo_PictureClick
End If
mb_Flag = KO
MouseOn

End Sub

Private Sub clickNodeLevel0(ByVal Node As MSComctlLib.Node)
'debug.assert (Node.Key Like "_0_*")

Init_Controls
If gut_Param.Str8 = "1" Then
'    gut_LangWork.Code = tlst_Memo.ItemStrValue(tlst_Memo.ListIndex)
    gut_LangWork.Code = ms_Lang(0, Mid(Node.Key, 4))

    If gut_Param.Str2 = "" Then
        Fill_Cbo_Type
    End If
    Def_Icons
    txt_Title = ""
    txt_comment = ""
    lbl_Title.Visible = KO
    txt_Title.Visible = KO
    Lbl_comm.Visible = KO
    txt_comment.Visible = KO
End If

End Sub

