CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Nov 2005
    Posts
    57

    Question OLE Drag problem with RTB | RichEdit

    Using VB6, I am trying to inhibit draging FROM an RTB control.
    It seems the rtb.OLEDragMode property has no effect, regardless if set to 0 automatic or 1 manual. No events fire, and I can always drag out selected contents. Am I missing something?

    I attempted to compare the operation of a standard text box, with the RTB. Unfortunately the standard textbox will not drag out regardless of TB.OLEDragmode value.

    Anyone familiar with these issues?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: OLE Drag problem with RTB | RichEdit

    Like this:

    With RichTextBox1
    ReadOnly = True
    Oops. That must be VB.Net slipping thru.
    Last edited by dglienna; February 16th, 2008 at 11:27 PM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Nov 2005
    Posts
    57

    Arrow Re: OLE Drag problem with RTB | RichEdit

    DG:

    No can do with the readonly(I presume you mean rtb.locked) as the control has to accept keyboard input.
    So...what is the OLEdragmode property for...is it broken?

  4. #4
    Join Date
    Nov 2005
    Posts
    57

    Unhappy Re: OLE Drag problem with RTB | RichEdit

    Setting the Readonly property, doesn't prevent the Copying of contents...only the moving...my hopes were to completely prevent copying or moving from the RTB, but i cant use the ReadOnly property anyway.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: OLE Drag problem with RTB | RichEdit

    If the mouse goes down in the rtb, you can clear the clipboard repeatedly until it leaves the rtb...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Nov 2005
    Posts
    57

    Exclamation Re: OLE Drag problem with RTB | RichEdit

    No...cant do that as the clipboard could contain data. Are you sure the clipboard even holds the drag data?...and remember no OLE events fire.

    I say again...what is the OLEDragmode property suppose to do? MS Documentation is vague on the property.
    Last edited by vb_lover; February 17th, 2008 at 01:32 AM.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: OLE Drag problem with RTB | RichEdit

    OK, ClearData then

    http://msdn2.microsoft.com/en-us/lib...ax(VS.80).aspx

    oops. all things are pointing towards vb.net on this one
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Nov 2005
    Posts
    57

    Thumbs down Re: OLE Drag problem with RTB | RichEdit

    ClearData is only going to work if an OLE event fires...

    DG: tell me if you know what the OLEdragmode property is suppose to do, seems like you are avoiding my repeated question...

  9. #9
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: OLE Drag problem with RTB | RichEdit

    Doesn't appear to be part of the RTB
    ComboBox Control
    DBCombo Control
    DBList Control
    DirListBox Control
    FileListBox Control
    Image Control
    ListBox Control
    PictureBox Control
    TextBox Control
    http://msdn2.microsoft.com/en-us/lib...45(VS.60).aspx
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: OLE Drag problem with RTB | RichEdit

    Here's a Listbox sample:
    Code:
    Private Sub Image1_Click()
    
    End Sub
    
    
    Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    End Sub
    
    Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' verify if data is a list of files not other ole object
    If Data.GetFormat(15) = True Then GoTo 10
    MsgBox "You cannot drop this object!"
    Exit Sub
    
    ' parse dropped objects data and list it!
    10
    a = Data.Files(Xc)
    
    End Sub
    
    
    Private Sub Picture1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
    
    End Sub
    
    
    Private Sub Picture1_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
    
    End Sub
    
    
    Private Sub Picture1_OLESetData(Data As DataObject, DataFormat As Integer)
    
    End Sub
    
    
    Private Sub Picture1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
    
    End Sub
    
    
    Private Sub Command1_Click()
    List1.Clear
    Label1.Caption = "Number of Objects = 0"
    End Sub
    
    Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' verify if data is a list of files not other ole object
    If Data.GetFormat(15) = True Then GoTo 10
    MsgBox "You cannot drop this object!"
    Exit Sub
    
    ' parse dropped objects data and list it!
    10
    Xc = Xc + 1
    If Data.Files.Count >= Xc Then a = Data.Files(Xc)
    If Len(a) > 0 Then List1.AddItem (a)
    If Data.Files.Count <= Xc Then GoTo 20
    GoTo 10
    
    ' update object counter
    20
    Label1.Caption = "Number of Objects = " & List1.ListCount
    End Sub
    
    
    Private Sub List2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    ' verify if data is a list of files not other ole object
    If Data.GetFormat(1) = True Then GoTo 10
    MsgBox "You cannot drop this object!"
    Exit Sub
    
    ' parse dropped objects data and list it!
    10
    a = Data.GetData(1)
    
    List2.AddItem (a)
    
    End Sub
    Attached Files Attached Files
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    Nov 2005
    Posts
    57

    Angry Re: OLE Drag problem with RTB | RichEdit

    DG: I must presume that you are not sure what the OLEdragmode property is suppose to do.

    Yea, i have already seen that example...doesn't help me in the least.

    I guess this is just another problem of an unfinished control created by the infamous BugMakers at MS.

  12. #12
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: OLE Drag problem with RTB | RichEdit

    OLEDRagMode describes how the dragging of the control is to work.
    If you set it to manual, it should not perform automatic dragging, but rather call or fire the apropriate events to let you determine the action.
    Look at RTB_OLEDragDrop(), RTB_OLECompleteDrag() and more related events. Check when they fire and try to inhibit the unwanted action from there.

  13. #13
    Join Date
    Nov 2005
    Posts
    57

    Arrow Re: OLE Drag problem with RTB | RichEdit

    Wof:
    What i was looking for was a more explicit definition of DRAGGING. Would you agree that DRAGGING is to REMOVE data(move or copy), in this case selected text, FROM the control??????? The act of Dragging moves data from the source TO a target.

    So if my definition is correct, the property OLEDragMode should control the behavior of dragging, if the source data is the RTB....but
    And i will state it again: the OLEDragmode property DOES NOT have ANY effect on the control. OLE Events do not get fired!!!!

    Can anyone contradict my claim that this property does not work in the RTB???
    Last edited by vb_lover; February 17th, 2008 at 09:12 AM.

  14. #14
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: OLE Drag problem with RTB | RichEdit

    I agree with your definition of dragging. You 'grab' data and drop it to another control which supports this OLE mechanism too.

    Comparing the rtb with a textbox, behaviour is different, yet illogical, or so it seems.
    Right, none of the events are fired (unlike they are in the textbox with the same settings).
    BUT as soon as you set the OLEDropMode to rtfOLEDropManual some of the events fire. (At least the OLEDragOver() )

    I have to admit that the operation seems quite buggy, doesn't work like expected. And is not to be inhibited like it works well in the TextBox control.
    I also must admit that I have no idea at the moment as haow to handle that...

  15. #15
    Join Date
    Nov 2005
    Posts
    57

    Question Re: OLE Drag problem with RTB | RichEdit

    Wof:

    My RTB._OLEDragOver event never fires, when RTB.OLEDragMode = rtfOLEDropManual. Have you actually tried this and it fires for you??

    Private Sub Commad1_Click ()
    RTB.OLEDragMode = rtfOLEDropManual
    End Sub

    Private Sub RTB_OLEDragOver(Data as .................)
    MsgBox "drag over"
    End Sub


    My version is 6.0 (SP6)

Page 1 of 2 12 LastLast

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

Featured