|
#1
|
||||
|
||||
|
Sample: Drag / Drop Object
This example illustrates how to use the On Mouse Move and On Mouse Button events to effectively drag and drop an object around your application.
Skills Used: On Enter, On Leave, On Mouse Move, On Mouse Button, GetPos. |
|
#2
|
||||
|
||||
|
Multiple Objects
The example works great for one object, but if you want to drag and drop multiple objects those that are higher up in the z-order "steal" the cursor from those lower down. One workaround is to put the following in the page's "On Mouse Button" event:
Code:
if e_Type == 0 and sObject then nOrigX = e_X; nOrigY = e_Y; tProps = Button.GetProperties(sObject); nPos = Button.GetPos(sObject); bReady = true; else bReady = false; end Code:
if not System.IsKeyDown(1) then bReady = false; end if sObject and bReady then nChangeX = e_X - nOrigX; nChangeY = e_Y - nOrigY; Button.SetPos(tProps.ObjectName, nPos.X + nChangeX, nPos.Y + nChangeY); end |
|
#3
|
||||
|
||||
|
Hello,
You can set Z-Order dynamically at runtime with AMS60: http://www.indigorose.com/webhelp/am...jectZOrder.htm Desmond. |
|
#4
|
||||
|
||||
|
Doh
Thanks! I thought I'd looked everywhere for that. Nope!
|
|
#6
|
|||
|
|||
|
Tried this
Hi I tried this template which works excellent and would be good for a test I am trying to design, but when I changed the buttons for graphics and pasted all the code into the relevant parts I kept getting an error message.
on mouse move, line 8:attempt to index global'npos'(a nil value) Any ideas as this would really help me out, thanks. |
|
#7
|
|||
|
|||
|
button
I'm not sure if this will work for your purposes but if you use the button maker you can import your image, create a button and then use the code to drag and drop the new button object on the page.
|
|
#8
|
||||
|
||||
|
Hi
You can also do the same with Images Change Button to Image Code:
if e_Type == 0 and sObject then nOrigX = e_X; nOrigY = e_Y; tProps = Image[/COLOR].GetProperties(sObject); nPos = Image.GetPos(sObject); bReady = true; else bReady = false; end Code:
if not System.IsKeyDown(1) then bReady = false; end if sObject and bReady then nChangeX = e_X - nOrigX; nChangeY = e_Y - nOrigY; Image.SetPos(tProps.ObjectName, nPos.X + nChangeX, nPos.Y + nChangeY); end |
|
#9
|
|||
|
|||
|
Image example!
|
|
#10
|
|||
|
|||
|
very useful thanks
|
|
#11
|
||||
|
||||
|
Sorry for reliving this thread but I'm having difficulty running this. I want to move a window based on a hotspot having the mouse clicked in it ... but it shakes like crazy...any tips guys?
|
|
#12
|
|||
|
|||
|
Not seen this problem can you post a demo APZ feller and i see if it does that this end?
|
|
#13
|
||||
|
||||
|
Hey Rex,
I learnt something instead. I didn't realise that if you disabled images they became skin as such and I could drag my form around no problems. Thanks though
|
|
#14
|
|||
|
|||
|
Quote:
|
![]() |
| Tags |
| drag&drop, object |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Action on Drag N Drop | Jonas DK | AutoPlay Media Studio 5.0 | 1 | 10-19-2008 09:55 AM |
| INFO: Difference between the Media Player Object and the AVI Object | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-29-2002 03:15 PM |
| HOWTO: Make a Media Player Object Go Full Screen | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-23-2002 12:23 PM |
| INFO: Minimum requirements for the Flash Object, Media Player Object, and Web Browser Object | Support | AutoPlay Media Studio 4.0 Examples | 0 | 10-04-2002 11:09 AM |
All times are GMT -6. The time now is 04:53 PM.










Linear Mode

