Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: Силblч
там надо разрешать редактировать
у меня flexgrid

Private Sub GridData_Click()
    If isEnableData = False Then Exit Sub
    Static is2Click%, cClickRow%, cClickCol%
    With GridData
        If cClickRow <> .Row Or cClickCol <> .Col Then
            is2Click = 1: cClickRow = .Row: cClickCol = .Col
        Else
            is2Click = 2: cClickRow = .Row: cClickCol = .Col
            If .Col > 5 And .Col < 18 _
                And .Row > 0 And .Row < (.Rows - 5) _
                    And isWeekEditable = True _
                        And isDayEditable(.Col) = True Then

                        .Editable = flexEDKbdMouse
                        .EditCell

            End If
        End If
    End With
End Sub

Private Sub GridData_KeyDown(KeyCode As Integer, Shift As Integer)
    If isEnableData = False Then Exit Sub
    With GridData
        If .Col > 5 And .Col < 18 _
            And .Row > 0 And .Row < (.Rows - 5) _
                And isWeekEditable = True _
                    And isDayEditable(.Col) = True Then
                    .Editable = flexEDKbdMouse
                    .EditCell
        End If
    End With
End Sub

Private Sub GridData_KeyDownEdit(ByVal Row As Long, ByVal Col As Long, KeyCode As Integer, ByVal Shift As Integer)
    On Error GoTo err12345
    If isEnableData = False Then Exit Sub
    If Shift = 2 And (KeyCode = 86 Or KeyCode = 236) Then '-- Ctrl+v(м) попытка вставить из клипборда руками
        If Len(Clipboard.GetText) > 0 Then '-- есть чё?)
            Call EditPaste
        End If
    End If
    Exit Sub
err12345:
    MsgBox Error, vbExclamation, "Ошибка #" & Err.Number
    Exit Sub
End Sub

Private Sub GridData_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
    If isEnableData = False Then Exit Sub
    With GridData
        If Button = vbRightButton _
           And .Col > 5 And .Col < 18 _
           And .Row > 0 And .Row < (.Rows - 5) Then
            .Editable = flexEDNone
            .FocusRect = flexFocusSolid
            Me.PopupMenu mnuEdit
        End If
    End With
End Sub

Private Sub GridData_AfterRowColChange(ByVal OldRow As Long, ByVal OldCol As Long, ByVal NewRow As Long, ByVal NewCol As Long)
    If isEnableData = False Then Exit Sub
    With GridData
        If OldRow > 0 And OldRow <> NewRow And OldRow < GridData.Rows - 5 Then
            .Cell(flexcpBackColor, OldRow, 5, OldRow, 17) = "&H00000000"
            .Cell(flexcpBackColor, OldRow, 24, OldRow, 24) = "&HE0E0E0"
        End If
    End With
End Sub

Private Sub GridData_RowColChange()
    If isEnableData = False Then Exit Sub
    With GridData
        '-- область редактирования
        .Editable = flexEDNone
        .FocusRect = flexFocusSolid
        If .Col > 5 And .Col < 18 _
            And .Row > 0 And .Row < (.Rows - 5) Then
            '-- область выделения
            .Cell(flexcpBackColor, .Row, 5, .Row, 24) = "&H00C0FFFF"
        End If
    End With
End Sub

Private Sub GridData_ValidateEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
    If isEnableData = False Then Cancel = True: Exit Sub
    With GridData
        If .ColDataType(Col) = flexDTDouble _
            And .Row > 0 And .Row < (.Rows - 5) Then
            If Not IsNumeric(nz(Num4Ora(.EditText), "0")) Then
                MsgBox "В этой колонке значение должно быть положительным числовым", vbInformation, "PCF"
                Cancel = True
            End If
        End If
    End With
End Sub


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.