Source language: Translate to:

Mouse Button state

Post your suggestions for future versions of NeoBook

Moderator: Neosoft Support

Mouse Button state

Postby dpayer » Mon Apr 29, 2013 9:23 am

When the question of a rotating dial came up in the plugin section, I thought of a way to do this with native NB components but I would need to know when the mouse button was depressed (not clicked - just down). Some action command like:
Code: Select all
Mousebuttonstate "[Up_or_Down]"

would be helpful.


I thought of another way to accomplish the rotating dial with drag/drop but a similar problem exists: when does the selection begin? We need to know when to start a process based on the selection of a draggable item.

I see that the cursor changes when we drag/drop, would it be possible to add a bit of information to the getobjectinfo action so when an item (text or polygon) has been selected by the mouse to drag (I guess when the drag has started) that we can have a means to act on that info? Example:
Code: Select all
GetObjectInfo "Text5" "SelectedForDragDop" "[selected]"


or automatically set the value of a variable, example: [SelectedForDragDrop.Text5] to be "True" (and show in the debugger) when the object has been selected.

These are not immediate priorities for me but may be helpful additions to the command set so we can use the mouse more dynamically. But if we get them, I will make a demo of how to use them for a rotating dial :)

Thanks for listening.

David P.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: Mouse Button state

Postby Neosoft Support » Mon Apr 29, 2013 12:01 pm

That's an interesting idea, but I'm not sure how well it would work within the context of NeoBook. If you could tell when an object was being dragged would you use a timer to handle the rotation? Would you need to change the object's image while it was being dragged to reflect the knob's position? I'm not sure either of those things would properly work since Windows (not NeoBook) handles the actually dragging process.

Currently, the click actions are triggered when the mouse button is released. Adding a mouse down action might work for some types of objects. This probably would be a better/easier solution that trying to use the drag/drop feature.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Mouse Button state

Postby Gaev » Mon Apr 29, 2013 12:25 pm

David P:

From the Help file ...
During drag and drop operations, NeoBook doesn’t actually move the object. Instead, a semitransparent ghost image representing the object follows the reader’s mouse cursor around the screen. The original object remains visible during this process, unless you enable the Hide object while dragging option.

So, the GetObjectinfo (Left and Top) on the dragged object might not return the expected information.

In order to be useful in the way you want to deploy 'Drag and Drop' you need ...

a) an additional event like DargStart ... so you can (perhaps) start a Timer

b) either Reserved NeoBook Variables (DragOffsetX and DragOffsetY) ... or additional Properties (with similar names) that are returned from the GetObjectInfo command ... that is continually updated from the DragStart to the DragDrop time period (and cleared upon return from the DragDrop event code).

c) perhaps an additional option for the Object that allows you to 'Hide/Show the ghost image'


Then, your TimerInterval code could respond to the offset values to determine how much rotation of the knobs is required.

A generic solution like this would enable Application Developers to include many other 'visual tricks related to drag operations' within their Publications.


@Neosoft Support:
Would you need to change the object's image while it was being dragged to reflect the knob's position?
I think the knob object would be different from the object being dragged (most likely a transparent one).
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Mouse Button state

Postby dpayer » Mon Apr 29, 2013 1:40 pm

Neosoft Support wrote:That's an interesting idea, but I'm not sure how well it would work within the context of NeoBook. If you could tell when an object was being dragged would you use a timer to handle the rotation? Would you need to change the object's image while it was being dragged to reflect the knob's position? I'm not sure either of those things would properly work since Windows (not NeoBook) handles the actually dragging process.

Currently, the click actions are triggered when the mouse button is released. Adding a mouse down action might work for some types of objects. This probably would be a better/easier solution that trying to use the drag/drop feature.


From a design point of view, having the mouse button depressed indicates selection. A click is used to initiate a predetermined action. When attempting to rotate (or in my case, emulate rotation - my view was to start with emulating the movement of the indicator notch around a circle) you can use the mouse location to position the indicator but you don't really want that to move if you just happened to roll the mouse over the dial. You only want to rotate the dial when you have held down the mouse button WHILE you were moving the dial in the circle. There is currently no way to know if the mouse button is down.

It is not intuitive to have to click a dial first and then rotate it. It is more intuitive to hold down the mouse button when over the dial and then move in the same manner you would use drag/drop. Drag/drop would be much less effective if you had to click on the item first before it became available to drag.

It may be that actually using drag/drop for this purpose (rotating dial) is not the ideal tool. Still, it is the closest native tool to being able to move something along a path with this 'select by holding down the mouse button' method.

I may be able to do this without any changes to NB. I could make the rectangle of the dial as a button. Then place a drag able object on a point on the circle. When the mouse enters the drag able object it sets a variable recording location. Mouse movement could be used to calculate position and the indicator notch could be moved from that process along the path of the circle. BUT if the button was Clicked (held down when you grabbed the dial to move it around the circle) then not only would you show movement of the indicator notch but the completion of the button click could be used to set the final location of the indicator when the mouse button was released. If the mouse button was NOT held down while doing this, you would only see the emulated move but the indicator would not change.

This would be a good exercise for me. I'll give it a try and see what I can come up with (based on free time!).

David P.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to NeoBook Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest