Jump to content
Sam Jones

Clearing Dialog pull down menu

Recommended Posts

Is there a way to clear out a pull down menu in a dialog, so that one can populate the pull down with entirely new content?

The code below does not seem to do the job.  It would be nice if there was a command similar to the "vsoWidgetPopupClear" that is used for OIP pull downs

 

        GetChoiceCount(Dialog, kTargetData2BOList, fieldCount);
        IF fieldCount > 0 THEN
            BEGIN
                FOR index := 1 TO  fieldCount DO
                    BEGIN
                        RemoveChoice(Dialog, kTargetData2BOList, index-1);
                    END;
            END; {IF fieldCount > 0 }

Share this post


Link to post

Sam,

   It looks like your code should work. Have you verified that "fieldCount" is > 0? If it is, are your "Dialog" ID, and your "kTargetData2BOList" constant correct?

 

   I use something similar in Reshaper, where GetChoiceCnt is a custom function that returns the menu size from GetChoiceCount(), just like yours.

	for I := 0 to GetChoiceCnt(dlogID, MenuItem)-1 do
		RemoveChoice(dlogID, MenuItem, 0);

 

HTH,

Raymond

 

Share this post


Link to post

This works for me in many cases:

 

FOR i := j DOWNTO 0 DO RemoveChoice(gDialog1, 29, i);

 

Perhaps you need to go backwards?

 

Julian

Share this post


Link to post

Sam,

   After reading Julian's comment I looked at your code and mine again; there is a difference. I always remove the 0th element (the element at the front of the list). Julian's way removes the last element every time. You are removing the element at the index counter, which is a moving target. Eventually, the list gets shorter than the index counter and you will receive a runtime error. You need to pick one of our two methods and you should be okay to proceed.

 

Raymond

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...