From: Lyle Johnson Date: 2002-01-25T10:16:58+09:00 Subject: Re: FXRuby Drag-and-Drop Code?? > Well I need two buttons connected by a line. Moving around the buttons should > not brack the line. I am writing an application based on graphs that I want > to resize using DND OK, I think you're sort-of describing a diagram-drawing program like Microsoft's Visio, or one of those UML diagramming tools like Rational Rose. This isn't really drag and drop, per se, since you're just dragging shapes around, but I still agree that it would be a useful thing to have as an example. Drag and drop is actual a much more powerful concept and has to do with data transfer within an application (or between different applications, for that matter). For a simple example, take a look at the "image.rb" example program included with FXRuby. Start this program, and click the "Colors..." button on the right-hand side of the main window to pop-up FOX's standard colors dialog box. Now select one of the color wells (i.e. the small colored squares) from the bottom edge of this dialog box and start "dragging it"; if you're over a valid drop site the mouse cursor looks like a little square, or if you're not over a valid drop site it turns into a little stop sign. Continue dragging the color well until you're on top of one of the three color wells on the right-hand side of the main window (the ones labelled Background, Border and Text Color Well) and then release the left mouse button to "drop" the color swatch. Depending on which color well you dropped the color into, you should see the image background color, the bars' outlines color or the text color change. For even more entertainment, try the same exercise with two *different* copies of the "image.rb" program running. You can drag from a color well in one instance of the program to a color well in a different instance just as you did with the previous example. Several of FOX's built-in widgets are similarly DnD enabled, but I'd like to incorporate a simple example that shows the basics for someone wanting to roll their own Dnd-enabled widget or application. This would be in addition to the diagram-drawing tool you described (which I also like the sound of).