Results 1 to 3 of 3

Thread: Simple text viewer in MP

  1. #1

    Simple text viewer in MP

    Hi

    Could anybody help to make a simple up-down text viewer from resource *.txt. [ like notepad but without ability to edit, only view ]

    Ill be wery glad and thankfull.

    str
    PsxDev-PL Creator [ www.psxdev-pl.tk ]
    <br />PsOne Development Studio 2006 Creator
    <br />MobiZine-PL Creator
    <br />And many other...

  2. #2

    Simple text viewer in MP

    Edit. Didn't see it was Midlet ops:
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #3

    Simple text viewer in MP

    Ok so here it is a quick dirty code made in 5minutes. Maybe together we could figure out something less buggy than this:

    Code:
    program ReadTextFromRes;
    
    var
    PageTextTableNumber&#58; integer;
    res   &#58; resource; 
    line  &#58; string; 
    i &#58; integer;
    TextTable &#58; ARRAY&#91;1..500&#93; of string;
    
    
    procedure processKeyActions;
    var		key&#58; integer;
    begin
    	key &#58;= keyToAction&#40;getKeyClicked&#41;;
    		
    	if key = GA_UP then 
         Begin PageTextTableNumber &#58;= PageTextTableNumber - 1; 
                SetColor&#40;0, 0, 0&#41;;
                DrawText&#40;texttable&#91;PageTextTableNumber&#93;, 10, 33&#41;;  
                Repaint;
         End;
         
    	if key = GA_FIRE then 
         Begin End;
         
    	if key = GA_DOWN then 
         Begin PageTextTableNumber &#58;= PageTextTableNumber + 1; 
                SetColor&#40;0, 0, 0&#41;;
                DrawText&#40;texttable&#91;PageTextTableNumber&#93;, 10, 33&#41;;  
                Repaint;
         End;
    
         
    
    end;
    
    begin
    PageTextTableNumber &#58;= 1;
    
    res &#58;= OpenResource&#40;'/data1.txt'&#41;; 
    
     if &#40;resourceAvailable&#40;res&#41;&#41; then 
      begin 
       for i&#58;=1 to 150 do
        begin
         texttable&#91;i&#93;&#58;=ReadLine&#40;res&#41;; 
        end;                    
       CloseResource&#40;res&#41;; 
      end; 
    
      
      while GetKeyPressed <> KE_POUND do 
        begin 
         processkeyactions;
        end;  
    	
    end.
    Its only simple code. Maybe you can propose something more useable.
    PsxDev-PL Creator [ www.psxdev-pl.tk ]
    <br />PsOne Development Studio 2006 Creator
    <br />MobiZine-PL Creator
    <br />And many other...

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
  •