Livecode
DRAG PANE DIVISION
Apparently simple tasks such as dragging the division between 2 fields (as shown above) or dragging the sides of any widget (to resize it) are not as
simple as they may seem. In the beginning, we need help, and even after a number of years' experience we might not quite remember exactly how to
do it! This little demo stack shows one way of dragging the division and achieving an auomatic resize of the 2 text fields within their fixed total area,
but quite possibly other simpler and more efficient methods exist. To see how it is done, look at the script of "List2" (the one on the right) and you will
see that it contains mouseDown, mouseMove, mouseRelease and mouseUp handlers.
But when you move the mouse over the division between field "List1" and field "List2", you want the cursor to change into the horizontal double-arrow
shape that you can see in the 2nd picture. You can either obtain a cursor image like this, or you can perhaps make one yourself. In the example, the
original file name of this image was "EW_08.gif". The first thing to do is to get this image permanenly into the stack (in the example, into the image
box "Pic1"), and this can be done by typing the URL command into the message box (not by putting it into a label field as shown above):
Of course, the message above assumes that the image file is to be found in the same folder as the stack you are working on, or at least it is in the stack's
defaultFolder. If not, then you can type the whole path to the image file:
Image "Pic1" would then normally be made invisible.
When it comes to using this image in your code to change the appearance of the mouse cursor, you might be tempted to try doing it like this:
set the cursor to image "Pic1"
NOT SO!
Instead, you need to discover its numeric ID by looking at the properties of image "Pic1", and use it as follows:
set the cursor to 1009
So with that big smile, hopefully, you will now have a better idea not only of how to drag pane divisions, but also how to drag the edges of
any widget.