Selection behaviour similar to delete

Status
Not open for further replies.

Andrew Lowe

Usenet Archive
Joined
Jul 8, 2000
Messages
27
Reaction score
0
Hi all,
I assume by now that we are all familiar with the behaviour of the delete commmand ;). We have several lines drawn and we wish to delete them. I select the first one, it is highlighted and then I click anywhere and it is deleted - no problem. I then click the second line, once again it is highlighted, and then I click the third line. The second line is immediately deleted and the third line is then highlighted, an accept the second for deletion and then select the third in one step.

This is my problem. I can do all of this in two steps, select the line, click anywhere and it is deleted AND THEN select the next line with another click etc etc. Does anyone have any sample code that shows how to do this "like" delete does it? I can't seem to get mdlState_startModifyCommand to do as I want and I am getting really confused with mdlState_startPrimitive, mdlLocate_*** etc etc so if anyone knows how to do the delete "style", accept and select in the one click, can they please let me know.

Thanks in advance,
Andrew Lowe

p.s. Obviously the sequence that I used, first line, no problem, second/third line, problem, has nothing to do with it. This could be done in any order.
 
You can use 'mdlState_startModifyCommand' to start your command and then in your 'acceptFunc' do the following tricks:

Private void acceptFunc (DPoint3d *ptP, int view)
{
ULong currFilePos, nxtFilePos;

// get the current element file position
currFilePos = mdlElement_getFilePos (FILEPOS_CURRENT, NULL); // do what you want, for examples, read elms and delete it

// use the same point to locate the next element
nxtFilePos = mdlLocate_findElement (ptP, view, 0, 0, TRUE);

mdlState_setFunction (STATE_DATAPOINT, acceptFunc); }

Good Luck.

Foo.
 
Andrew, I hope this is what you're looking for,

This code will allow you to identify the next element as you accept the previous one. It also allows for fence and selection set processing.

Sample command function:

Private void prependTextCmd (void)
cmdNumber CMD_TEXTUTIL_PREPEND
{
mdlState_clear ;

setTextSearchCriteria ;

if (tcb->fence && useFence)
{
mdlState_startFenceCommand (processFencePrepend, NULL, NULL, NULL, 10, 5, FENCE_NO_CLIP); } else if (mdlSelect_isActive == FALSE) { mdlState_startModifyCommand (prependTextCmd, acceptPrepend, NULL, NULL, NULL, 10, 2, FALSE, 0); } else { mdlState_startPrimitive (acceptPrepend, rejectFunction, 10, 3); }

// set the locate pointers to start at beginning of file . . mdlLocate_init ; }

Sample acceptFunction:

Private void acceptPrepend
(
Dpoint3d *pt,
int view
)
{
if (mdlSelect_isActive == TRUE)
mdlModify_elementMulti (MASTER_FILE,
0L,
MODIFY_REQUEST_HEADERS, MODIFY_ORIG, editText, NULL, TRUE); else { mdlModify_elementSingle (0, mdlElement_getFilePos (FILEPOS_CURRENT, 0), MODIFY_REQUEST_HEADERS, MODIFY_ORIG, editText, NULL, 0L); mdlLocate_init ; mdlLocate_restart (FALSE); } }

Regards,
 
Status
Not open for further replies.

Latest threads

Back
Top