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.
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?
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.
ComboBox Control
DBCombo Control
DBList Control
DirListBox Control
FileListBox Control
Image Control
ListBox Control
PictureBox Control
TextBox Control
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
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.
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.
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...
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.