HP Forums
Grid program - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Grid program (/thread-14572.html)



Grid program - cahlucas - 02-25-2020 06:37 PM

Hi all,
The program that I present here must draw a grid of lines on the screen, the dimensions of which are determined by the parameters that you provide. If it is executed, the program only gives a white screen without any grid. The program does not give an error message, so the code is correct (no syntax error). Can someone help me get this program working? Sincerely, Karel.

Code:

#pragma mode(separator(.,;) integer(h32))
EXPORT CENTER_GRID(xsize,ysize,rows,cols)
BEGIN
RECT();
LOCAL xmin,xmax,ymin,ymax,xcrd,ycrd;
xmin:=160-((xsize+1)*cols+1)/2;
ymin:=120-((ysize+1)*rows+1)/2;
xmax:=160+((xsize+1)*cols+1)/2;
ymax:=120+((ysize+1)*rows+1)/2;
FOR ycrd FROM ymin TO ymax STEP 'ysize+1' DO
LINE_P(G0,xmin,ycrd,xmax,ycrd,#000000);
END;
FOR xcrd FROM xmin TO xmax STEP 'xsize+1' DO
LINE_P(G0,ymin,xcrd,ymax,xcrd,#000000);
END;
FREEZE
END;



RE: Grid program - Tonny - 02-25-2020 09:37 PM

Try changing the stepsize from 'ysize+1' to (ysize+1)


RE: Grid program - cahlucas - 02-25-2020 10:20 PM

Dear Tonny,
That helped well! Thank you for your contribution. Sincerely, Karel.