Page 1 of 1

split panels

Posted: Fri Aug 07, 2009 11:14 am
by ConvertFromOldNGs
by Dave Mac >> Wed, 14 Apr 1999 3:57:09 GMT

Hi,
can anyone tell me how to replicate the split panel functionality found in the class browser in the JADE IDE. ( You can use the mouse to drag and resize the classes, attributes, methods and method listing panels / frames etc. )

Many thanks - Dave.

Re: split panels

Posted: Fri Aug 07, 2009 11:14 am
by ConvertFromOldNGs
by Craig Shearer >> Wed, 14 Apr 1999 20:06:09 GMT

Hi Dave

Creating a splitter bar in JADE is pretty simple, once you know how to create custom controls, and draw on a parent control!

You'd simply have a frame control that knew how to respond to mouseDown, mouseMove, and mouseUp events and reposition itself accordingly.

I wrote a couple of splitter bar controls a while ago now, including advanced features like the ability to register dependant controls - ie. set up your splitter bar with the controls you want to resize, and have it automatically resize/move them according to where the splitter bar is dragged.

Anyway, here's some stuff you might find useful...

You should draw a rectangle in the mouseMove event to show the user where the splitter bar is being dragged to. Here's how:

drawRect(pos: Real) protected;

vars
begin

parent.drawMode := DrawMode_Xor;
parent.drawWidth := 1;
parent.drawFillStyle := DrawFillStyle_Solid;
parent.drawFillColor := White;

parent.drawFilledRectangle
(
left,top + pos - offset ,
left + width,top + pos - offset + height,
White
);

end;

On the mouseDown event, record the position of the mouse, set some state to say you're in drag mode, and draw the rectangle on the parent control. Then, on each mouse move, redraw the rectangle in the old position (the Xor will cause it to restore the previous pixels) then draw the rectangle in the new position. Finally, on the mouseUp event, move the control to the new position.

Of course, you'd want to have a mouse cursor for the splitter bar control. You can set the mousePointer to a special setting that allows a custom cursor (using a .cur file) as follows:

mousePointer := MousePointer_Icon;

then you'll need to set the mouseCursor property. You'll need to find a way of storing the image somewhere. In our systems, we have a collection of images on the global object, but you could just as easily store in on a form, or even load it from a file...

mouseCursor := app.loadPicture("hSplitter.cur");

Finally, I've included a couple of cursors that you'd probably want to use.

Hope this helps,
Craig.

Re: split panels

Posted: Fri Aug 07, 2009 11:14 am
by ConvertFromOldNGs
by Craig Shearer >> Thu, 15 Apr 1999 19:49:48 GMT

One more tip, you need to have the clipControls property set to false for the parent control of the splitter bar. Otherwise, you won't see very much of the rectangle, as Windows will prevent you from drawing on the other controls.

Craig.

Re: split panels - fx.zip (0/1)

Posted: Fri Aug 07, 2009 11:14 am
by ConvertFromOldNGs
by Paul Mathews >> Thu, 15 Apr 1999 9:21:20 GMT

We have a used a simple approach, as demonstrated in the form Fx in
the attachment. Essentially have a Label with an appropriate
mouseCursor <=> to seperate two frames. Have mouseDown, mouseMove, and nouseUp events on the label. But what moves is not that label but a cloned version of it. Similarly a horizontal affect can be achieved.

Paul Mathews
pem@cmsystemsgroup.com.au
Phone: [612] (99717384) Fax[612] (99711679)
(Dee Why,Sydney,Australia)

Please visit our homepage cmsystemsgroup.com.au.

Re: split panels - fx.zip (1/1)

Posted: Fri Aug 07, 2009 11:14 am
by ConvertFromOldNGs
by Paul Mathews >> Thu, 15 Apr 1999 9:21:21 GMT

Here you go.