Results 1 to 3 of 3

Thread: select checkbox with mouse drag

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Location
    rajkot
    Posts
    4

    select checkbox with mouse drag

    dear friends,

    i want to select checkboxes from the form on which the mouse is
    drag over.

    there are near about 40 check boxes.

    one more need is there i can select all chekbox with mouse drag,
    but it is possible when shift key is pressed .

    how can this possible?????confused:
    Attached Files Attached Files

  2. #2
    Lively Member
    Join Date
    Nov 2002
    Location
    Delaware
    Posts
    126
    If your trying to select the checkboxes when THEY are hovered over do this:

    VB Code:
    1. Private Sub Check1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3. 'MsgBox Shift
    4.  
    5. If Check1(Index).Value = 0 And Shift = 0 Then
    6.     Check1(Index).Value = 1
    7. ElseIf Check1(Index).Value = 1 And Shift = 1 Then
    8.     Check1(Index).Value = 0
    9. End If
    10.  
    11. End Sub

    Otherwise if you want them highlighted when the Form is hovered over then:

    VB Code:
    1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3.     For X = 0 To 3
    4.         If Check1(x).Value = 0 And Shift = 0 Then
    5.             Check1(x).Value = 1
    6.         End If
    7.     Next X
    8.  
    9. End Sub

    All this is easier if the checkboxes are in a control array

    Hope this helps!
    Dave

    [vbcode]

    Dim ScrewingAround as cIncessant.Need

    Set ScrewingAround = New cIncessant.Need

    If atWork = True then
    Call ScrewingAround.begin
    Else
    Call ScrewingAround.begin
    End If

    [/vbcode]

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    I don't know if I understand your question.

    If you want to be able to select a checkbox by moving the mouse over it (when the Shift key is held down), then this code should work:
    VB Code:
    1. Private Sub Check1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     ' If shift is held down when mouse passes over, then select the checkbox
    3.     If Shift And vbShiftMask Then
    4.         Check1.Value = vbChecked
    5.     End If
    6. End Sub
    Or, are you actually DRAGGING over (as in drag and drop)?
    ~seaweed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width