Page 1 of 1

COLOR clause in DSMSGBOX

Posted: Tue Feb 02, 2010 2:35 pm
by fursideup
need a way to change colors on message boxes

Re: COLOR clause in DSMSGBOX

Posted: Tue Feb 02, 2010 2:45 pm
by rdonnay
I can do this, but then all text will be the same color.
I'll send you an update.

Re: COLOR clause in DSMSGBOX

Posted: Fri Feb 19, 2010 2:01 pm
by fursideup
that will be fine

Re: COLOR clause in DSMSGBOX

Posted: Fri Feb 19, 2010 2:24 pm
by rdonnay
Make the following change to DCDIALOG.CH:

Code: Select all

#xtranslate DCMSGBOX <list,...>       ;
           [TITLE <cTitle>]        ;
           [TIMEOUT <nSeconds>]    ;
           [<yesno:YESNO>]         ;
           [TO <output>]           ;
           [FONT <cFont>]          ;
           [BUTTONS <aButtons>]    ;
           [CHOICE <nChoice>]      ;
           [HOTKEY <cHotKey>]      ;
           [EVAL <bEval>]          ;
           [ICON <nIcon>]          ;
           [<nr:NOAUTORESTORE>]    ;
           [<always:ALWAYSONTOP>]  ;
           [_ALWAYSONTOP <_always>];
           [COLOR <nFg> [,<nBg>]]  ;   <<<<<<<<<<  
   =>                              ;
  [<output> := ] ;
    DC_MsgBox(,,{<list>},<cTitle>,,<nSeconds>,<.yesno.>,<nChoice>, ;
              <aButtons>,,,<cHotKey>,<cFont>,<bEval>,<nIcon>,<.nr.>, ;
              <.always.>[.OR.<_always>], ;
              [{<nFg>,<nBg>}] ) <<<<<<<<<<<<
Make the following change to _DCMSG.PRG

Code: Select all

FUNCTION dc_msgbox ( nRow, nCol, aMessage, cTitle, lWait, nSeconds, lYesNo,;
                     nChoice, aItems, aMenuId, cMenuName, cHotKey, cFont, ;
                     bEval, nIcon, lNoRestore, lAlwaysOnTop, ;
                     aColor )   <<<<<<<<


      FOR i := 1 TO LEN(aMessage)
        @ nLine, 1 DCSAY Pad(aMessage[i],nWidth) FONT cFont SIZE 0
        IF Valtype(aColor) == 'A'  <<<<<<<<<<<
           ATail(GetList)[aGETLIST_COLOR] := aColor  <<<<<<<<<<<
        ENDIF  <<<<<<<<<<<
        nLine++
      NEXT
dcmsgbox.zip is attached

Copy _dcmsg.prg to \exp19\source\dclipx and run build19_sl1.bat to rebuild dclipx.dll