Dockable Panes
Robert Sneidar
slylabs13 at me.com
Sat Dec 29 22:46:26 EST 2012
Is the area the panes display in fixed? Are the pane sizes fixed? I think you need to investigate drag and drop commands and functions. If the panes are a fixed size and their positions are fixed, it's pretty simple to determine the next open space (if that's what you want) and see if anything is displayed there. You can keep a property updated for the card to tell you when a pane "slot" is occupied or not by having an array with however many slots you want as it's key. The name of the pane object goes into the array element for that slot. If nothing is there put empty into the array element.
To position them simply set the top of one pane to the bottom of the upper pane, and set the left to be equal. If you are dragging and want to "snap" then in your dragMove handler loop to check for proximity to another pane, and if for example the top of the pane you are dragging is within lets say 10 or 15 pixels of the bottom of the upper pane, then call your positioning routine. To "unsnap" it keep track of the mouse position once snapped and if the mouse moves more than the 10 or 15 pixels away from the center of the pane (the loc of the pane) then set the loc of the pane to the mouseLoc.
That is rather vague pseudocode, but if you are looking for a technique, that may help. Without knowing more about the interface you envision, I don't think I can say more.
Bob
On Dec 29, 2012, at 5:48 PM, mfstuart at cox.net wrote:
> Hey all,
> I'm interested in building an LC desktop application interface that has dockable panes/panels in it.
> What are dockable panes? For example: think of a window that has a vertical and a horizontal line, to form 4 panes in the window.
>
> In this example:
> Top left pane is #1
> Top right pane is #2
> Bottom left pane is #3
> Bottom right pane is #4
>
> Here are some of the characteristics of dockable panes:
> - a pane would be resizeable by dragging the line/frame that separates each pane
> - a pane could be removed, and later reinstated
> - a pane could be moved/dragged to another panes position, which would be added and appear as a tab. The 2 panes become tabs in that panes position
> example: if the bottom left pane (#3) was dragged into the top left position (#1), panes 1 and 3 take up the space of 1 and 3, and are "presented" as a tab control. Panes 2 and 4 remain as they were.
> - if a pane appears as a tab, the tab (which is the pane) can be dragged and moved to another position
> - a panes movable property is a logical, therefore a pane with false in its movable property, could not be dragged to another position
> - each pane becomes a container for any other control type that can be placed on a stack/card
> - a panes contents would always remain with it
> - a pane would have a "header" to it, which displays a title and buttons to the far top right of the pane.
>
> That's the basics of it, and there can be all sorts of things that can be done. But I'll start with that.
>
> I've started this thing, but I'm already mind blocked on it.
> I've also spent some time searching the use-list and forum, using some key words:
> dockable pane, pane, panels, drag me, container
>
> Does anyone have something to help me get started, or maybe an example?
>
> Regards,
> Mark Stuart
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list