Jump to content

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
                FOR index := 1 TO  fieldCount DO
                        RemoveChoice(Dialog, kTargetData2BOList, index-1);
            END; {IF fieldCount > 0 }

Link to comment


   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);





Link to comment


   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.




Link to comment
  • 3 years later...

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.

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.

  • Create New...