Going between stacks

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Going between stacks

Post by laurpapo » Mon Jun 25, 2012 4:07 pm

Hi,

So I have a substack that is being used as a kind of tool palette, with various buttons on it. One of these buttons functions to create a new field on the main card when pressed. I want to enable a sort of click and drag feature, so that when the button is clicked, the user can hold the mouse down, an image of the field appears (I have this part down) and then they can move the mouse onto the main stack and 'drop' the field (in reality, the field that appears on the tool palette is just an image, and I want the actual field to be created on mouseup on the main card).

Is this possible? I'm having trouble navigating between the stacks while keeping the mouse down.

Thanks!

-Laurel

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Going between stacks

Post by laurpapo » Mon Jun 25, 2012 4:11 pm

Or if there is a way to change the cursor to an image, that would help. I couldn't figure that one out either...

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Going between stacks

Post by townsend » Mon Jun 25, 2012 4:38 pm

Changing the cursor to an image:

Code: Select all

on mouseUp --turn image on
     set lockcursor to true
     set cursor to 1210
end mouseUp

on mouseUp -- turn image off
  set lockcursor to false
end mouseUp

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Going between stacks

Post by laurpapo » Mon Jun 25, 2012 4:45 pm

It works for changing my cursor to something, but I think my image is too big. Is there anyway I can change the cursor to the size of my image?

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Going between stacks

Post by townsend » Mon Jun 25, 2012 5:24 pm

I think you can make the image smaller by adjusting the width and height.

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Going between stacks

Post by laurpapo » Mon Jun 25, 2012 5:30 pm

Hmmm thanks for the help but won't quite achieve what I'm going for. I think I just have to figure out how (if possible) to move between stacks even when the mouse is down, which I am having an impossible time doing.

Thanks!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Going between stacks

Post by Mark » Mon Jun 25, 2012 6:10 pm

Hi,

Make a new stack, add an image of a field to it, set its windowShape to the id of the image and set the style of the stack to palette. Name the stack "Field Shape". Create a button with the following script:

Code: Select all

on mouseDown
  set the loc of stack "Field Shape" to the screenMouseLoc
  show stack "Field Shape"
  repeat until the mouse is up
    set the loc of stack "Field Shape" to the screenMouseLoc
  end repeat
  hide stack "Field Shape"
  // check if the mouse cursor is within an "editable" window and
  // create your field etc.
end mouseDown
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Going between stacks

Post by laurpapo » Mon Jun 25, 2012 6:42 pm

Wow! That is exactly what I needed. Thank you so much, Mark!

Post Reply