/* * $VER: Streifen.rexx V1.0 (16.06.2000) * * Copyright 2000 by Christoph Kirsch * * This script will change the background colors of the cells * marked. You can choose two colors and wether there will * be horizontal or vertical stripes. * */ options results address 'DATAM_II.1' /* First we request the used language */ QUERY LANGUAGE lang = result /* Set some messages, according to the used language */ if lang = "deutsch" then do errBlatt = "Es ist kein Blatt aktiv!" errKeinBlock = '"Es ist kein Block markiert!|Bitte vor dem Aufruf markieren."' msgFarbe1 = '"Bitte die erste Farbe wählen"' msgFarbe2 = '"Bitte die zweite Farbe wählen"' msgFName1 = "Weiß" msgFName2 = '"Grau 25%"' msgRichtung = '"Sollen horizontale oder vertikale|Streifen entstehen?"' msgWahl1 = "vertikal|horizontal" end else do errBlatt = "There is no active sheet!" errKeinBlock = '"No block marked!|Please mark a block befor calling."' msgFarbe1 = '"Please choose first color"' msgFarbe2 = '"Please choose second color"' msgFName1 = "white" msgFName2 = '"grey 25%"' msgRichtung = '"Do you wish horizontal|or vertical stripes?"' msgWahl1 = "vertical|horizontal" end /* Get a pointer to the active sheet */ GETACTIVE SHEET blatt = RESULT if blatt ~= 0 then do /* Lock the sheet */ LOCK blatt /* Get the block coordinates and seperate them */ GETBLOCK blatt block = RESULT x1 = WORD(block,1) y1 = WORD(block,2) x2 = WORD(block,3) y2 = WORD(block,4) /* If there's no block marked: Return error */ if x1 == x2 & y1 == y2 then do REQUESTNOTIFY errKeinBlock UNLOCK blatt exit end /* Request the direction */ REQUESTCHOICE '"Streifen.rexx - DataM II"' msgRichtung msgWahl1 richtung = RESULT /* Request the colors to use */ REQUESTCOLOR BODY msgFarbe1 COLOR msgFName1 f1 = RESULT REQUESTCOLOR BODY msgFarbe2 COLOR msgFName2 f2 = RESULT /* First set the background to color 2 */ SETATTR blatt BACKGROUND f2 SETBLOCK blatt OFF /* Then set the background of each second row */ if richtung = 0 then do do y = y1 to y2 by 2 do x = x1 to x2 GOTO blatt x y SETATTR blatt BACKGROUND f1 end end end else do do y = y1 to y2 do x = x1 to x2 by 2 GOTO blatt x y SETATTR blatt BACKGROUND f1 end end end /* Remark the block, redraw and unlock sheet */ SETBLOCK blatt x1 y1 x2 y2 REDRAW blatt ALL UNLOCK blatt end else do /* Throw an error, if there's no active sheet */ REQUESTNOTIFY errBlatt end