home *** CD-ROM | disk | FTP | other *** search
- (*
- This is the best way I know to select colors. It is similar to the
- color setup in TInst and/or MakeMenu. You should include this code
- in DER11.ARC
-
- The NEW Interface section should look like:
- *)
- Interface
- Uses
- Crt,
- Dos,
- Dates, { Scott Bussinger's Dates unit from CIS BORPRO DL2 }
- QWIK, { Jim LeMay's QWIK40a unit from CIS BORPRO DL2 }
- WNDWVars,{ This has been added }
- WNDW; { Jim LeMay's WNDW40 unit from CIS BORPRO DL2 }
-
- Function SelectColor(RR,CC,DR,DC : Byte) : Byte;
- (*
- In the Implementation section add:
- *)
- Function SelectColor(RR,CC,DR,DC : Byte) : Byte;
- { Coordinates of Color Window: (RR,CC) ... (RR+10,CC+18)
- DR = Default Row color selection
- DC = Default Col color selection
-
- No Error checking is done, so make sure RR is in [1..15]
- and CC is in [1..60]
- }
- Const
- Clear : Char = #4;
- Flag : Char = #15;
- Var
- Row,
- Col : Byte;
- Att : Integer;
- TC : Char;
- TLimit,BLimit,Rlimit,LLimit : Byte;
-
- Begin
- TLimit := RR + 1;
- BLimit := RR + 8;
- LLimit := CC + 1;
- RLimit := CC + 16;
-
- MakeWindow(RR,CC,10,18,-1,-1,SingleBrdr,aWindow);
- TitleWindow(Top,Center,' Colors ');
- For Row := 0 to 7 Do For Col := 0 to 15 Do
- Begin
- Att := Attr(Col,Row); { Col = foreground, Row = background }
- QFill(RR + Row + 1,CC + Col + 1,1,1,Att,Clear);
- End;
-
- Row := RR + DR;
- Col := CC + DC;
- Repeat
- GotoRC(Row,Col);
- QFill(Row,Col,1,1,-1,Flag);
- TC := ReadChar;
- QFill(Row,Col,1,1,-1,Clear);
- Case TC Of
- CursorDown: Begin
- If Row = BLimit Then Row := Tlimit
- Else Inc(Row);
- End;
- CursorUp: Begin
- If Row = TLimit Then Row := BLimit
- Else Dec(Row);
- End;
- CursorRight: Begin
- If Col = RLimit Then Col := LLimit
- Else Inc(Col);
- End;
- CursorLeft: Begin
- If Col = LLimit Then Col := RLimit
- Else Dec(Col);
- End;
- End;
- Until TC = Return;
- RemoveWindow;
- {
- Note:
- ForeGround := Col - CC - 1
- BackGround := Row - RR - 1
- }
- SelectColor := Attr(Col - CC - 1,Row - RR - 1);
- End;