![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Peter Rolf wrote:
Hi all,
I pass a string to a MP graphic using \setMPtext{LABEL}{TEXT}. The string can also be empty, and then no action (for the text) is taken. How can I test in MP, if the given \MPstring{LABEL} is empty?
I have tried everything I can imagine in the last one hour, but no success. Not my day...
This is the old, not working version
if not(\MPstring{LABEL}="") : % is always true.
unless to set it to nothign (currently you don't assign it at all) take this: \setupcolors[state=start] \starttext \startuseMPgraphic{test} fill fullcircle scaled 1cm withcolor if not(\MPstring{XX}="") : red else : green fi ; \stopuseMPgraphic \useMPgraphic{test} \start \setMPtext{XX}{} \useMPgraphic{test} \stop \unprotect \def\MPtext #1{\executeifdefined{\@@MPT#1}\empty} \def\MPstring #1{"\executeifdefined{\@@MPT#1}\empty"} \def\MPbetex #1{btex \executeifdefined{\@@MPT#1}\empty etex} \protect \useMPgraphic{test} \start \setMPtext{XX}{} \useMPgraphic{test} \stop \stoptext the current definitions return "\relax" when a text is not defined; i'll change the definitions Hans