formsys (lx_formsys.hpp)

From The Foundry MODO SDK wiki
Jump to: navigation, search
There are security restrictions on this page


Forms and the SDK

Generaly speaking, forms is not accessible through the SDK. You should never create new controls in a form procedurally using the attr.??? commands, and the form hierarchy cannot be read -- it is intended to be a black box defined exclusively through configs. The only way to procedurally create controsl is via a Form Command List, which is described in the command system documentation.

We do present some interfaces for drag and drop of controls into forms. These are primarily used internally, and are likely of little use to the third parties.

ILxFormEntryDest

Dropping into a Form View exposes an ILxFormEntryDest object describing what is under the mouse.

(1) SDK: Declarations
 #define LXu_FORMENTRYDEST       "d8c44d68-ba77-4193-942a-d59ee115d99f"
 #define LXa_FORMENTRYDEST       "formdropdest"

The hash of form containing the control that was dropped on is returned by this method. It is important to note that in some cases this may be NULL.

(2) SDK: ILxFormEntryDest interface
         LXxMETHOD( LxResult,
 FormHash) (
         LXtObjectID               self,
         const char              **hash);

This returns the hash of the control under the mouse, or the closest one that can be reasonably dropped on. For example, if the control is synthetic, then the drop location will be between the the control that defined the Form Command List and the one following it.

Note that since some controls can be represented by forms (popover forms, popup forms, etc), the control hash may be a form hash.

(3) SDK: ILxFormEntryDest interface
         LXxMETHOD( LxResult,
 ControlHash) (
         LXtObjectID               self,
         const char              **hash);

This returns the position of the drop within the control as a combination of the following defines.

(4) SDK: Declarations
 #define LXmFORMDROPPOS_EDGE             0x0000000F
 #define LXmFORMDROPPOS_ON               0x000000F0
 
 #define LXfFORMDROPPOS_NONE             0
 
 // The edges themselves
 #define LXfFORMDROPPOS_ON               0x00000001
 #define LXfFORMDROPPOS_LEFT             0x00000002
 #define LXfFORMDROPPOS_RIGHT            0x00000003
 #define LXfFORMDROPPOS_TOP              0x00000004
 #define LXfFORMDROPPOS_BOTTOM           0x00000005
 
 // These are only used if the edge is LXfFORMDROPPOS_ON
 #define LXfFORMDROPPOS_ON_ANY           0x00000000
 #define LXfFORMDROPPOS_ON_LABEL         0x00000010
 #define LXfFORMDROPPOS_ON_HOT           0x00000020
 
 #define LXxFORMDROPPOS_EDGE(x)          (LXmFORMDROPPOS_EDGE & (x))
 #define LXxFORMDROPPOS_ON(x)            (LXmFORMDROPPOS_ON   & (x))

(5) SDK: ILxFormEntryDest interface
         LXxMETHOD( LxResult,
 Position) (
         LXtObjectID               self,
         int                      *pos);

ILxFormEntryDropPreview

The preview interface allows the drop point to be marked within the pane.

(6) SDK: Declarations
 #define LXu_FORMENTRYDROPPREVIEW        "43908515-dd63-4b36-a8ca-5699d018825d"
 #define LXa_FORMENTRYDROPPREVIEW        "formentrydroppreview"

This sets the hash of the control (which may be a form, for controls that are built from forms) that the marker should be associated with, as well as the position relative to the control itself. The EXTENT defines can be combined with the position flag to span the entire pane instead of just the bounds of the control.

(7) SDK: Declarations
 #define LXmFORMDROPPOS_EXTENT            0x00000F00
 
 #define LXfFORMDROPPOS_EXTENT_COMPONENT 0x00000000
 #define LXfFORMDROPPOS_EXTENT_PANE       0x00000100
 
 #define LXxFORMDROPPOS_EXTENT(x)         ((x) & LXfFORMDROPPOS_EXTENT)

(8) SDK: ILxFormEntryDropPreview interface
         LXxMETHOD( LxResult,
 MarkControl) (
         LXtObjectID               self,
         const char               *hash,
         int                       pos);

ILxFormDeleteEntryDest

This very simple interface exists simply to indicate that the drop is in a place that can support deleting form entries.

(9) SDK: Declarations
 #define LXu_FORMDELETEENTRYDEST "a70bedf3-bd43-40c9-9e77-a7632e0f35ed"
 #define LXa_FORMDELETEENTRYDEST "formdeleteentrydest"

We don't really need a method, but the interface requires it, so we provide a way to delete an entry (control or sheet) given its hash.

(10) SDK: ILxFormDeleteEntryDest interface
         LXxMETHOD( LxResult,
 Delete) (
         LXtObjectID               self,
         const char               *hash);