If you define an item in the dropdown's Properties as having a blank value (i.e. Something that may be relevant to this discussion, but I have not seen mentioned: Try to select something from the dropdown, you will find that it has no entries but continues to display the placeholder text. The placeholder text continues to display Select an item. TheĭELETE this first item from the list and close the properties box. Now double-click the word Choose and replace it with Select. Place a dropdown list content control in a document. Here is a repeat of part of an earlier post, but with some clarification. ![]() IF nothing was selectedīefore running the Sub, the placeholder text displays even though the list is empty. IF the user had selected an item before running this Sub, that item name continues to display even though the list is empty. What does the MsgBox display? Turn design mode on and check the properties of the list. Just before the With statement insert the lineĪctiveDocument.SelectContentControlsByTitle("M圜Ctrl")(1).DropdownListEntries.Clear Take the code you listed in your last post. The shift in goalposts was in response to your first post. With ActiveDocument.SelectContentControlsByTitle("M圜Ctrl")(1).DropdownListEntries You can prove it for your self with code like: Otherwise the code I posted wouldn't work. What else would you expect? And, contrary to your assertion, the placeholder text My code is perfectly OK it's your understandingĪs for: However one changes the placeholder in design mode, that change remains when NOT in design mode. Which is quite wrong, and proceeded to try to prove that by changing the placeholder text and claiming that, because the default placeholder text isn't returned by the code I provided, my code is therefore wrong. Then you came back saying: The placeholder text is not the same as the first item in the DropDownListEntries. In you first post you said: I want to unselect or deselect the selected item if the user has selected an item in the list You seem to be continually shifting the goal posts. But doing so,ĭisplays Choose an item in black text not gray, as is the placeholder text. I believe making the first item equal to the placeholder text provides a workaround for what I am trying to do, namely remove the selection from the list. Thus, the placeholder text is distinct and separate from the first item in the list. If you programmatically CLEAR the DropDownListEntries, the dropdown list now contains no entries but continues to display the placeholder text Select an item. ![]() If you exit design mode and try to select something from the dropdown, you will find that it has no entries.įurthermore, add some items to the list. Thus, the first item in the list is NOT the placeholder text.ĭELETE this first item from the list and close the properties box. The first item in the list is Choose an item, NOT Select an item. The placeholder text is now Select an item. The placeholder text is not the same as the first item in the DropDownListEntries. There seems (at least to me) to be a misunderstanding about the placeholder text in a dropdown list.
0 Comments
Leave a Reply. |