In case you're interested...

3 views
Skip to first unread message

EagleEye

unread,
Aug 12, 2008, 3:40:16 AM8/12/08
to EEGUI
Ever wonder what kind of logic has to go in to determining if
something is going to be dragged around the screen?

If isMouseDown >= 0 _
AndAlso GUI_MouseState.ButtonStates(isMouseDown) _
AndAlso Enabled _
AndAlso DragBehavior > DragBehaviors.DoNotAllow _
AndAlso CanBeDragged(isMouseDown) _
AndAlso DraggingObject Is Nothing _
AndAlso (Math.Abs(MouseDownPoint.X -
(GUI_MouseState.Location.X - RenderLoc.X)) >= MoveDistanceBeforeDrag
Or Math.Abs(MouseDownPoint.Y - (GUI_MouseState.Location.Y -
RenderLoc.Y)) >= MoveDistanceBeforeDrag) _
AndAlso Now.Subtract(MouseDownStart).TotalMilliseconds >=
DelayBeforeDrag Then

So if the mouse is down ON THIS OBJECT...
and the GUI still has the mouse state as being down
and the control is enabled
and the drag behavior is NOT "DoNotAllow"
and the control can be dragged with that mouse button
and there is no current dragging object
and the distance moved by the mouse since it went down is greater than
the distance before drag in either the X or Y dimensions
and the time sine the mouse went down is greater than the drag
delay...

ONLY THEN can an object start dragging around the screen.

And it usually all happens in an instant. :)

That said... some coming changes:

8/11/08
:- For textbox input, caused CONST_TV_KEY.TV_KEY_NUMPADENTER to be
treated just like CONST_TV_KEY.TV_KEY_RETURN (both are now considered
ascii code 13)
:- guiButton now reacts to CONST_TV_KEY.TV_KEY_NUMPADENTER with a
raised even code of -3. (CONST_TV_KEY.TV_KEY_RETURN = -2,
CONST_TV_KEY.TV_KEY_SPACE = -1, otherwise the code is the index of the
mouse button)
:- Added helper functions to DrawnComponent class to enable/disable
colors/textures for all states (base, selected, down, disabled, over).
:- Fixed bug in Dragging event, where distance dragged was always
equal to (0,0) - Was making previous mouse location equal to current
mouse location prior to raising the event... Oops.
:- Fixed bug in dragging event, where movement would happen at
inappropriate times.
:- Changed guiListBox's inheritance from guiWindowEnhanced, which had
a top bar and close button, to guiScrollingWindow, which just has
scrollbars attached.
:- Changed all controls so that if they are not enabled, they can not
be dragged.

8/5/08
:- Added a List (collection) object to guiTextBox called
"FilterKeys". Add single character strings to this list to filter out
undesired keystrokes such as spaces (MyTextBox.FilterKeys.Add(" ")),
or other special characters.
:- Added function "AddFilters" to guiTextBox to allow you to enter
multiple keys to the FilterKeys list. Param is a comma deliated
string. ie: "\, ,/,!,@,#,$"
:- Added "Show" and "Hide" methods to guiControlBase... they're simple
"visible = true" and "visible = false" subs, but were added for
convenience.
Reply all
Reply to author
Forward
0 new messages