Results 1 to 2 of 2

Thread: Simple Text-Based Page-Display System

  1. #1

    Simple Text-Based Page-Display System

    Just a simple page display system which will list the entire contents of an array until it meets an empty number (ie, timer[76] = 't' and timer[77] = ''). It shows it in page format, with a configurable number of items per page, by customizing the 'listnuma' value. Non-Commented version at the bottom.

    Note: This code is being used in my upcoming Task Scheduler I am creating.

    Code:
    Timer 1: g
    
    Timer 2: g
    
    Timer 3: g
    [pascal]
    Procedure ListItems;
    begin
    x := 1; {Set X as one. This should be whatever you want the first item to be.}
    Repeat {Create the first lpage}
    if timer[x] <> '' then begin {timer[1..50] is what I have set.}
    Writeln('Timer ',x,': ',timer[x]); {Writes to screen the current number of X, in my case, the current list item, then the name of the timer.. the name of the timer would be timer[1].}
    bool := false; {bool is false, to say that the current list item is NOT empty. If empty, it closes the loop and thats the last item shown.}
    x := x+1; {Increment the current list item by one.}
    Readln; {Pause. Not necessary, remove as wished.}
    end else begin writeln('EMPTY!'); bool := true; readln; end; {If timer[x] = '' (empty) then say 'empty'. ONLY the bool := true statement in this end... else is necessary.}
    Until (x = listnuma+1) or (bool = true); {listnuma is the user-configurable number that you want displayed per page. if listnuma is set to 5, 5 items are displayed per page. If bool not equal to true, then continue with next page.}
    ClrScr; {Clear the screen... open a new page.}
    if bool = false then begin {Bool must be false, meaning, the current item cannot be empty, for next page to continue.}
    listnumx := listnuma; {This here is outside the second page loop. This sets listnumx (the first value of the next page) to the max value of the last.}
    listnumz := listnuma+listnuma; {This sets the maximum value (last item on the page)}
    Repeat {Begin the actual loop for EVERY SINGLE following page, not just one.}
    Repeat {show the page loop}
    if timer[x] = '' then bool := true; {Is the timer empty?}
    if timer[x] <> '' then begin {If the timer is not empty, then...}
    Writeln('Timer ',x,': ',timer[x]); {Show the list item... Same as above.}
    x := x+1; {Increment x by 1.}
    bool := false; {Bool stays false, since the item is not empty.}
    Readln; {not necessary, just for a pause. Depends how quick you want the items shown on screen.}
    end;
    Until (x = listnumz) or (bool = true); {Is the current item either empty, or the last item?}
    listnumz := listnumz+listnuma; {Create the new last page. Will do nothing if the current item is empty...}
    ClrScr; {Show new page}
    Until bool = true; {All pages shown.}
    end;
    end;
    [/pascal]

    [pascal]
    Procedure ListItems;
    begin
    x := 1;
    Repeat
    if timer[x] <> '' then begin
    Writeln('Timer ',x,': ',timer[x]);
    bool := false;
    x := x+1;
    Readln;
    end else begin writeln('EMPTY!'); bool := true; readln; end;
    Until (x = listnuma+1) or (bool = true);
    ClrScr;
    if bool = false then begin
    listnumx := listnuma;
    listnumz := listnuma+listnuma;
    Repeat
    Repeat
    if timer[x] = '' then bool := true;
    if timer[x] <> '' then begin
    Writeln('Timer ',x,': ',timer[x]);
    x := x+1;
    bool := false;
    Readln;
    end;
    Until (x = listnumz) or (bool = true);
    listnumz := listnumz+listnuma;
    ClrScr;
    Until bool = true;
    end;
    end;
    [/pascal]
    --MagicRPG--

  2. #2

    Simple Text-Based Page-Display System

    So was this of any use to anybody?
    --MagicRPG--

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •