Post Reply 
Grid program
02-25-2020, 06:37 PM (This post was last modified: 02-25-2020 06:38 PM by cahlucas.)
Post: #1
Grid program
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;

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
02-25-2020, 09:37 PM
Post: #2
RE: Grid program
Try changing the stepsize from 'ysize+1' to (ysize+1)
Find all posts by this user
Quote this message in a reply
02-25-2020, 10:20 PM
Post: #3
RE: Grid program
Dear Tonny,
That helped well! Thank you for your contribution. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)