THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/09/2009 at 02:46, xxxxxxxx wrote:
Here is a basic example of rectangle selection with class LassoSelection.
> \> Bool LiquidToolData::MouseInput(BaseDocument \*doc, BaseContainer &data;, BaseDraw \*bd, EditorWindow \*win, const BaseContainer &msg;) \> { \> Real mx = msg.GetReal(BFM_INPUT_X); \> Real my = msg.GetReal(BFM_INPUT_Y); \> Real start_x = mx; \> Real start_y = my; \> Real dx,dy; \> LONG button; \> \> switch (msg.GetLong(BFM_INPUT_CHANNEL)) \> { \> case BFM_INPUT_MOUSELEFT : button=KEY_MLEFT; break; \> case BFM_INPUT_MOUSERIGHT: button=KEY_MRIGHT; break; \> default: return TRUE; \> } \> \> BaseContainer bc; \> BaseContainer device; \> win->MouseDragStart(button,mx,my,MOUSEDRAG_DONTHIDEMOUSE|MOUSEDRAG_NOMOVE); \> while (win->MouseDrag(&dx;,&dy;,&device;)==MOUSEDRAG_CONTINUE) \> { \> if (dx==0.0 && dy==0.0) continue; \> \> mx+=dx; \> my+=dy; \> \> AutoAlloc<C4DObjectList> olist; \> if (!olist) return FALSE; \> \> AutoAlloc<LassoSelection> ls; \> if (!ls) return FALSE; \> \> ls->Start(win, MOUSESELECT_RECTANGLE, start_x, start_y, BFM_INPUT_MOUSELEFT); \> \> if (SelectionListCreate(doc, NULL, bd, mx, my, ls, olist)) \> { \> GePrint(LongToString(olist->GetCount())); \> } \> } \> \> if (win->MouseDragEnd()==MOUSEDRAG_ESCAPE) \> { \> } \> \> return TRUE; \> } \>
Also check the ViewportSelect class for detection/selection with a defined radius.
cheers,
Matthias