FUNCTION ChooseColour() while true ' start COLOURS section case $itemtype when "A" desMRC = "N/A" exit while when "O" desMRC = left(suppname,20) exit while when "F" if prodcode == addn_lab x = entryline(" Additional description ",20,"","",21,5,72) desMRC = ptstr else desMRC = "N/A" end if exit while otherwise ' Check colours & add if necessary while true $popstr = [Colours] if upper($popstr) ! "N/a" desMRC = $popstr exit while else x = strcount($popstr) if x = -1 x = EnterColour() ' returns - (0) Success; (1) Unable to add if x = 1 ShowBox() return (-1) elseif x = -1 return (-1) elseif x = 0 desMRC = $newcolor return (2) ' new colour end if desMRC = $newcolor continue while else #nritems = ptval end if strtcol = 0 for i = 1 to #nritems y = GROUP($popstr,i) x = len(GROUP($popstr,i)) if x > strtcol strtcol = x end if end for strtcol = 72 - strtcol screen clear box 21 5 22 77 0 0 no-border y2 = format(" Select colour and press {Enter} - {Esc} to enter new colour ","M72") screen print 21 5 fgp bbd y2 if ASC(desMRC) = 0 $popcol = colpopup(7,strtcol,18,[Colours],"",1,0,14,11,0,7) else $popcol = findcolpop(7,strtcol,18,[Colours],"",desMRC,1,0,14,11,0,7) if $popcol = -5 $popcol = colpopup(7,strtcol,18,[Colours],"",1,0,14,11,0,7) end if end if screen clear box 1 56 1 80 0 0 no-border if $popcol = 0 desMRC = ptstr exit while elseif $popcol = -1 screen shortrestore dsa $popcol = EnterColour() ' returns - (0) Success; (1) Unable to add if $popcol = 1 ShowBox() return (-1) elseif $popcol = -1 return (-1) elseif $popcol = 0 desMRC = $newcolor return (2) end if desMRC = $newcolor exit while elseif $popcol = -2 $popcol = EnterColour() ' returns - (0) Success; (1) Unable to add if $popcol = 1 ShowBox() return (-1) elseif $popcol = -1 exit while elseif $popcol = 0 exit while end if desMRC = $newcolor exit while end if end if end while end case exit while end while ' end of Colour check END FUNCTION ' ChooseColour()