Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Dynamic Form Generator Collapse All
Subject Author Date
santosh g Dec 27, 2007 - 11:50 PM

Hi All,

I wanted to genrate a dynamic form, where i want the controls like button,text boxes to be moved and dragged/dropped anywhere in the application...as we have in VC++6.0 editor, like we select a control from tools box, drag it and drop it on the application... A similar one i need in my application which has list of controls (buttons, labels, textboxes) that can be dragged and dropped anywhere in the application...Please help me out....get me on with some examlpe or concept

Thanks and Regards,
Santosh

Technical Support Jan 11, 2008 - 10:56 AM

This is demonstrated in the following methods of the CFormEditorView class:

OnLButtonDown()
OnLButtonUp()
OnMouseMove()

santosh g Jan 9, 2008 - 3:21 AM

Hi,

I am again stuck in the same problem, am not able to find out the code for resizing and moving the form controls. Could anyone please provide me with some example coding so that i would implement the same in my project.

Thank You in advance,

Thanks & Regards,
Santosh

Technical Support Jan 3, 2008 - 6:03 AM

The FormEditor sample application uses standard OLE drag-n-drop APIs via MFC wrapper classes. You need to create your own COleDropTarget-derived class for each window which will accept dropping. The CFormEditorMdiTabWnd::CMdiTabOleDropTarget class implements drop target for MDI tab window. In fact you cannot drop anything into the tab items of the MDI tab control, but if you have several MDI child frames open in the FormEditor sample application and dragging toolbox items over tab items of the MDI tab control, then it activates appropriate MDI child frames what make them available for dropping. The CFormEditorToolBoxWnd::CToolBoxOleDropTarget class implements drop target interface for the toolbox window. You can drop toolbox item into the same toolbox control. The CFormEditorView class implements the form editing window. It’s also drop target and you can drop toolbox items into it. Both COleDropTarget and CView classes are defined in MFC and have the similar virtual methods for implementing drop target: OnDragEnter(), OnDragLeave(), OnDragOver() and OnDrop(). These methods should be implemented in your drop target classes in the similar way like you see in the FormEditor sample application. The CFormEditorToolBoxWnd::OnToolBoxWndStartItemDrag() virtual method is invoked when the CExtToolBoxWnd control detects click on the toolbox item and further mouse pointer shift to some small distance what is assumed as drag-n-dropping start event. This virtual method uses standard COleDataSource object and invokes its COleDataSource::DoDragDrop() method to start OLE drag-n-drop algorithm. The OLE drag-n-drop algorithm operates with portion of binary data which has known registered clipboard format to allow drop target objects know what is drag-n-dropped over them. The FormEditorsample application uses its own binary data format registered as clipboard format in the constructor of the CFormEditorToolBoxWnd class. Please also note, the OLE drag-n-dropping feature is part of OLE and its outside COM. It will not work if you initialize basic COM library only with invoking of the CoInitialize() or CoInitializeEx() APIs. You should invoke OleInitialize() or AfxOleInit() instead.

santosh g Dec 30, 2007 - 10:53 PM

:-) Thank You for the reply, Yes, formeditor! this what i was looking for...Yup, thing is now i would like to know how this ole-drag and drop controls works, i want to look through how the code works for drag and drop & movement of the controls in the alligned grid... Am looking for piece of code which does this drag-drop and dragging of items...Please help me out

Thanks in advance

Technical Support Dec 29, 2007 - 7:34 AM

The general concept of form editor is demonstrated in our FormEditor sample. You can find another interesting example of form editor here.



Suhai Gyorgy Dec 28, 2007 - 9:30 AM

I’m not sure if it is what you need, but check out the FormEditor sample.