Hi Wolfgang,
In the first example, so I do not need the command \currentheadnumber but just do :
\setuphead
[chapter]
[command=\HeadTitle,
headstyle=\ss,
numbercommand=\Headed]
But in this second example, using the command \determineheadnumber[chapter], the chapter number is always 0
\setuppagenumbering[location=footer]
\startusableMPgraphic{NumberHead}
picture r ;
r := image ( graphictext
\MPstring{chapter}
scaled 4pt
withfillcolor \MPcolor{lightgray}
withpen pencircle scaled 1pt ; ) ;
draw r ;
\stopusableMPgraphic
\defineoverlay[NumberHead][\uniqueMPgraphic{NumberHead}]
\def\processMPheadnumber#1%
{\setMPtext{chapter}{\bf#1}
\useMPgraphic{NumberHead}}
\unexpanded\def\HeadTitle#1#2%
{\framed
[frame=off,
bottomframe=on,
width=broad,
align={broad,nothyphenated,left}]
{#1\blank[nowhite]#2}}
\determineheadnumber[chapter]
\setuphead
[chapter]
[command=\HeadTitle,
headstyle=\ss,
numbercommand=\processMPheadnumber{\currentheadnumber}]
\starttext
\startchapter
[title={Fist chapter}]
\input knuth
\stopchapter
\startchapter
[title={Second chapter}]
\input knuth
\stopchapter
\startchapter
[title={Third chapter}]
\input knuth
\stopchapter
\stoptext