[Gambas-user] a few drag and drop questions
Benoit Minisini
gambas at ...1...
Sat Jul 30 12:26:30 CEST 2005
On Friday 29 July 2005 21:47, Nick wrote:
> Hello-
>
> I'm new to this mailing list, and new to gambas, so I hope I'm not
> being redundant (I've already searched the docs and mailing list
> archives). I'll include a link to my source at the end of this mail.
>
> My firsty question deals with this sub:
>
> PUBLIC SUB TreeView1_MouseMove()
> IF Mouse.Left AND TreeView1.Available THEN
> IF TreeView1.Find(Mouse.ScreenX - TreeView1.ScreenX, Mouse.ScreenY
> - TreeView1.ScreenY) THEN
> RETURN
> ENDIF
> Drag.Icon = tm.nodePicture
> TreeView1.Current.Selected = TRUE
> TreeView1.Drag(TreeView1.Key, Drag.Text)
> ENDIF
> END
>
> ...ok, this is the sub that initiates the drag... at first i tried to
> do this within the event handler TreeView1_MouseDown(). This doesn't
> seem to work; TreeView1.Find should set the treeview's internal cursor
> to the node that the mouse was over, TreeView1.Current.Selected =
> TRUE should select the node, so that TreeView1.Key is the key of the
> node the mouse was over... but instead, TreeView1.Key is the key of
> the last node that was selected.Could this be a bug, or am i just
> doing it wrong?
The internal cursor set TreeView1.Item, not TreeView1.Current, that is the
current item selected by the user.
>
> second question -
>
> PUBLIC SUB TreeView1_Drag()
> TreeView1_DragMove()
> END
> PUBLIC SUB TreeView1_DragMove()
> IF Drag.Source <> TreeView1 OR TreeView1.Find(Drag.X, Drag.Y) THEN
> STOP EVENT
> ELSE
> TreeView1.Item.Selected = TRUE
> ENDIF
> END
>
> This restricts the treeview to be it's own only drop target, only when
> there's a node under the mouse. It seems to work fine, except for one
> thing... if you drag a node and let it go somewhere on the tree, not
> on another node, or if you try to drag something external to the
> application onto the control, you lose the ability to initiate a new
> drag event! The tree nodes are not draggable again until the right
> mouse button is clicked (which shows a context menu in my
> application.) Any suggestions on this?
I'm not sure to understand well... I will look your application, maybe it will
be clearer for me.
Did you look at drag & drop example ?
>
> One more small question having nothing to do with drag and drop:
> What's my best bet for creating a rich text editor control? Inheriting
> from either TextView or TextArea, or using a DrawingArea with a
> buffer, or something else, or just wait for someone to write one in C?
>
There is a rich text editor in qt3, I simply didn't take the time to make a
Gambas control from it. Moreover, this control changes in qt4, so I am not in
a hurry for doing a thing I must change later :-)
> Here's a link to the application so far.. any other suggestions are
> welcome too; just keep in mind this is the product of only a few days
> of intermittant work, so don't judge too harshly =)
>
> http://www.freepgs.com/ufo/nick/treenote.tar.gz
>
> Thanks in advance for any advice.
> --Nick
>
Regards,
--
Benoit Minisini
mailto:gambas at ...1...
More information about the User
mailing list