Drag 'n Drop support

Discussion in 'Questions (Windows Mobile)' started by DavidN, May 16, 2007.

  1. DavidN

    DavidN Member Licensed User

    Does basic4ppc support drag 'n drop? If so, then How?

    For example, can I rearrange a bunch of objects on the screen by tapping an object with the stylus and dragging it to a new location? Preferably with some kind of "snap to grid/object" capability.

    Thanks

    David

    :sign0104:
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes, you can design the interface using drag and drop.
    Just choose from the menu - Designer - Create new form.
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    David,

    Why not just check it out, it's free for 30 days so you've nothing to lose!

    There's plenty of help here in our little forum so welcome and feel free to ask lots more questions.

    Regards,
    RandomCoder
     
  4. DavidN

    DavidN Member Licensed User

    Been away for a bit... now back to this problem....

    I understand that the basic4ppc IDE supports drag 'n drop for designing forms, but what I meant was how would I develop an application that used a drag 'n drop type interface. In other words, I want to develop an app where the user can click on a control/image/icon with the stylus and drag it over to a new location. Possibly getting it to snap to a grid or other "anchor".

    Thanks
     
    Last edited: Aug 9, 2007
  5. BjornF

    BjornF Active Member Licensed User

    Dear DavidN,

    I think you can just use the focus property to select e.g. the image (image.focus=true when clicked) and then use the x and y of "mouse up" to get the new location on the form. Put the new x,y as e.g. the image.top and image.left.

    If you want it to snap to a gridline you can construct your own using the integer values of a division (e.g. y=5*int(y/5) gives a grid line every 5th pixel).

    This method does not show the intermediate steps however, so the control will be seen to jump from the present spot to where you perform the mouse up. Does this matter?

    all the best, Björn
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This is will not work as the Image control only supports the Click event (without the x,y position).
    You should draw the image on the form and redraw it at the new position using MouseDown / MouseUp events (you could also use MouseMove event).
    It will be easier to do it on the ForeLayer.
     
  7. Cableguy

    Cableguy Expert Licensed User

    Or you can put yor image control as a child of a panel, wich supports mouse events, you can set the panel width an height to the image width and height and set the panel top and left according to mouse moves...
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    This will not work as the image click event will be raised and not the panel mouse down / move / up events.
     
  9. Cableguy

    Cableguy Expert Licensed User

    I satnd corrected...
    But if the panel is a bit larger and the user only taps the panel, then it should work?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    This should work fine.
     
  11. DavidN

    DavidN Member Licensed User

    Thanks!

    Thanks everyone. :)

    Figured out forelayer operation in forms, and a few other things that should provide a variety of ways to do what I want. Basic4ppc seems to be a great product, and the forum support is super. Thanks Erel for a product that makes me want to code stuff up just for the fun of it.

    BTW I spent a week in Israel at the end of April. Really liked the land and the people. My friend and I rented a car in Haifa and drove around northern Israel for 2 days, before she spent a week at a physics conference in Zfat while I went to Eilat and on to Jordan.
     
Loading...