Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dragging a pageframe

Status
Not open for further replies.

sdocker

IS-IT--Management
Aug 12, 2010
218
GB

I have a small page frame on a form that I would like to be movable, which is not a pageframe property.

I tried using the mouse properties/methods but it ended up being jerky and one directional.

Any sample code or link will be helpful. I'm willing to do the research if I'm pointed in the right direction.

Sam

 
Pages are not movable. You can set a Pages PageOrder, though. Setting one page order always also effects all others, as a pageorder needs to be unique, VFP manages that automatically.

Now it's quite hard to develop a mouse drag event to set a pageorder correctly. If I where you I'd perhaps use a separate Listbox with Movers=.T., showing the page captions, so the user can sort there, then set the page orders accordingly in Listbox.Interactivechange() event.

Bye, Olaf.

 
Sam,

A quick and dirty way of doing drag and drop is to set the control's DragMode property to 1. That allows the user to drag the control (the pageframe, in this case) to anywhere within the parent container. Dragging doesn't actually move the control; it simply establishes a destination for it. You use the DragDrop event to actually perform the action implied by the drag-and-drop. For example, if you want the drag-and-drop to move the control, you write code in DragDrop to reposition the control to the relevant location (typically by calling its Move method).

However, the preferred way to do drag and drop in VFP is with the OLE methods. There's a whole bunch of methods and properties whose names begin with OLE, such as OLEDrag, OLEDragMode, OLEStartDrag, and so on. These are more complicated than the simple DragMode property, but they give you much more control. Plus they have the advantage of supporting drag-and-drop across applications.

I won't try and give you more details here. I suggest you start by reading the Help topic called "OLE Drag and Drop", and also perhaps look at the sample code in this form: ...\Samples\Solution\Tahoe\Querydd.scx. Then, when you have some detailed questions, come back.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 

Thanks guys, for getting me started.

Will work on these responses over the weekend.

Sam
 
Sam,

I assumed you wanted to drag the entire page frame. But when I saw Olaf's reply, it made me think you wanted to drag an individual page within the frame. Aplogies if I misunderstood your question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top