LeftSingle+LeftDrag

Recommended Posts

would some kind soul post a SIMPLE mouse drag example.i looked at a couple of older posts but they are a bit obtuse for a beginner to decipher.can i drag in both X & Y ? ( its a stick controling a designator on a radar screen; so i need up down right and left) i am currently useing + shifts...how sad plz help

Share this post

Share on other sites
 Help AVSIM continue to serve you!Please donate today!

I think you can combine MoveLeft/Right/Up/Down with LeftSingle etc. Something like this:(M:X) x1 0 > (M:X) x2 60 < (M:Event) 'LeftSingle' scmp 0 == and and if{ do something here } Not tried though. Look in the GPS gauge, it is full of these things./Tom

Share this post

Share on other sites

Hi,This could be a simple reference: (M:Event) 'LeftDrag' scmp 0 == if{ ...(M:X) gives you the X drag coordinates, starting at 0 in the leftmost point and ending at 100. Outbounds to the left returns a negative value, and to the right a value greater than 100.(M:Y) gives you the Y drag coordinates, starting at 0 in the topmost point and ending at 200. Outbounds from the top returns a negative value, and to the bottom a value greater than 200.Indeed you can drag by both X/Y axis, individual or together.Combinations of "LeftSingle+LeftDrag";"LeftSingle+Drag";"LeftDrag+RightDrag"; etc can be used as well to achieve very complex actions.For example this is a basic Throttle drag:(M:Event) 'LeftDrag' scmp 0 == if{ (M:Y) 134 / 100 * 0 max 100 min 100 - /-/ 163.84 * (>K:THROTTLE1_SET) }Hope this helps. Tom

Share this post

Share on other sites

i still don't see it srry.frm what i see the "LeftSingle+Drag" looks like what i need.(i saw the gps but i guess i am missing some fundimental cause it is gibbrish to me) i am getting lost at the coordinates of the movement part, ie;if{ (M:Y) 134 / 100 * 0 max 100 min 100 - /-/ i do understand how to use(if not how it works) the scmp 0 ==i use it for push buttons, where the animation will return to the 'normal' state upon release. which is what i want here.i am wanting to animate a small movement of the bitmap. about 10 pixels off set ion the left or right or up or down direction. on release i want the bitmap to retrun to its original position.the bitmap is a picture of a control stick (much like the control stick for ailerons and rudder, but this one moves a radar cursor) does the mouse drag move the bitmap? or do you move VARIBLE X and VARIABLE Y then position the bitmap with code else where in the gauge?here is the gauge, you can see what i am trying to do, not knowing how to drag i just pushed the stick with side clicks...draging from a single 'hot' area would be preferable. the stick movement moves x & y variables that are used in the radar (seperate gauge)to position a 'cursor' my intention is to have a single 'active' area on the bitmap to use for moving the stick. the stick also has a button programed below, and will have more when i figure this out. (L:shftY, enum)(L:shftX, enum)(G:Var2,bool) (G:Var1) 1 == if{ (L:posY,enum) 2 - (>L:posY,enum) } (L:posY,enum) 25 < if{ 25 (>L:posY,enum) } (G:Var1) 2 == if{ (L:posY,enum) 2 + (>L:posY,enum) } (L:posY,enum) 185 > if{ 185 (>L:posY,enum) } (G:Var1) 3 == if{ (L:posX,enum) 2 - (>L:posX,enum) } (L:posX,enum) 25 < if{ 25 (>L:posX,enum) } (G:Var1) 4 == if{ (L:posX,enum) 2 + (>L:posX,enum) } (L:posX,enum) 160 > if{ 160 (>L:posX,enum) } (M:Event) 'LeftSingle' scmp 0 == if{ -4 (>L:shftY, enum) 1 (>G:Var1) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:shftY, enum) 0 (>G:Var1) } (M:Event) 'LeftSingle' scmp 0 == if{ 4 (>L:shftY, enum) 2 (>G:Var1) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:shftY, enum) 0 (>G:Var1) } (M:Event) 'LeftSingle' scmp 0 == if{ -4 (>L:shftX, enum) 3 (>G:Var1) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:shftX, enum) 0 (>G:Var1) } (M:Event) 'LeftSingle' scmp 0 == if{ 4 (>L:shftX, enum) 4 (>G:Var1) } (M:Event) 'Leave' scmp 0 == if{ 0 (>L:shftX, enum) 0 (>G:Var1) } (M:Event) 'LeftSingle' scmp 0 == if{ (L:spoton,enum) ! (>L:spoton,enum) 1 (>G:Var2) } (M:Event) 'Leave' scmp 0 == if{ 0 (>G:Var2) }

Share this post

Share on other sites

Ridgell,I think I understand what you want to do. Very feasible through mouse drag, but needs a bit of ellaboration.COuld you post a picture of the bitmap that you want to rotate ? (shift in any direction) A portion of its background bmp would be great as well.Tom

Share this post

Share on other sites

in my example the background was a black square with the same dementions as the 'markgrip' but i cut a piece of the larger back ground for you to use. the space is tight, the movement to any side is 4 pixels...not room for more, its a subtile movement. the bitmap had to be made to a jpg to load here, on the background i poSted the grip would be located the button and switch on the grip are used, loacte the drag area away from them so accedental button/switch press is avoided. i would use; on the grip.jpgthank you for the help.i do not understand how you designate the motion area of the 'drag'i tried about 1/2 dozen times to upload the jpg file, when i attach something the forum makes me re-login...me thinks its brokenif you do not mind go here, and you can copy and paste them. you can also see the rest of the cockpit and the context i am working in.http://www.stormlords.com/Viggen.htm

Share this post

Share on other sites

Ok, you could try this: (L:shftY, enum) (L:shftX, enum) (G:Var2,bool)(L:posX,enum) (L:shftX, enum) 2 / + 25 max 160 min (>L:posX,enum)(L:posY,enum) (L:shftY, enum) 2 / + 25 max 185 min (>L:posY,enum)(M:Event) 'LeftDrag' scmp 0 ==if{ 0 (M:X) sp0 (* Area is 36 px wide, divided in 3 chunks: 0-11 Left move 12-22 neutral 23-35 right move *)l0 >= 0 l0 11 <= if{ -4 } l0 11 > l0 22 <= if{ 0 } l0 22 > l0 35<= if{ 4 } (>L:shftX, enum)0(M:Y) sp0 (* Area is 26 px high, divided in 3 chunks: 0-9 up move 10-16 neutral 17-25 down move *)l0 >=0 l0 9 <= if{ -4 } l0 9 > l0 16 <= if{ 0 } l0 16 > l0 25<= if{ 4 } (>L:shftY, enum)}(M:Event) 'Leave' scmp 0 ==if{ 0 (>L:shftX, enum) 0 (>L:shftY, enum) }(* I left this untouched *)(M:Event) 'LeftSingle' scmp 0 == if{ (L:spoton,enum) ! (>L:spoton,enum) 1 (>G:Var2) }(M:Event) 'Leave' scmp 0 == if{ 0 (>G:Var2) }Please replace offending < and other symbols in the final code.NOT TESTED, but I guess should work (almost) fine :-)Tom

Share this post

Share on other sites

thank you for your efforts! fixed the greater and less thans. still some odd things. when over the grip a mouse click causes movement in the oblique, down-right. i could then drag side to side but only could get sporatic vertical dragging. i noticed the x-drag was inverted so i switch the 4 & -4 and that fixed the side to side drag. the vertical drag does not work correctly...not sure why. it jumps vertically occasionally but only for an instant then returns to nuetral.perhaps rather then shift the bitmap i could use the drag to set a variable, and choose from 4 bitmaps. forward tilt, rear tilt, etc.i originally thought that would look better, but was puzzeled about how to place the button. i figured the button would have the same coordinates on a shifted image some i used that. but what looked like the easy solution might be proving the more difficult in the long run.

Share this post

Share on other sites

>when over the grip a mouse click causes movement in the oblique, >down-rightTO avoid this effect you might put:And insert this snippet: (M:Event) 'Leftsingle' scmp 0 ==if{ 0 (>L:shftX, enum) 0 (>L:shftY, enum) }>the vertical drag does not work correctly...not sure why. it jumps >vertically occasionally but only for an instant then returns to >nuetral.Vertical (Y) should work the same as X . I can't find anything wrong at first sight. Maybe you could test leaving X drag control first, then leaving Y drag control and see what happens.>perhaps rather then shift the bitmap i could use the drag to set a >variable, and choose from 4 bitmaps. forward tilt, rear tilt, etc.Could be a a nice variant...Anyway, you have now a good start point for testing.Good luck!Tom

gracias maestro!

Share this post

Share on other sites

Hey, de nada che :-)

Share this post

Share on other sites

en ingles para los otros;i had to dumb up your code, to see what you were doing.translated all the register stuff to vars, then i could get the spacing right; funny how a blank spot or lack of can kill a piece of code; and i saw that what i could not figure out was in the (M:X) thats how it knows where your pulling/pushing, what a potent 5 characters! its still a little jittery but working in all directions. i can probably smooth it out refining the to a cross like shape. again gracias!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

• Tom Allensworth,
Founder of AVSIM Online

• Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

Click here for more information and to see all donations year to date.
• Donation Goals

AVSIM's 2019 Fundraising Goal

Donate to our annual general fund. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.

\$20,135.00 of \$36,000.00 goal reached.
Donate Now