home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,369 of 2,978   
   Jochen to All   
   Re: Tabs in WinCrt   
   10 Feb 05 17:14:01   
   
   From: jotel99@hotmail.com   
      
   Hello ng,   
      
   Marco van de Voort typed:   
   > On 2005-02-09, Brian  wrote:   
   >> On Tue, 08 Feb 2005 21:00:29 +0000, Mike Dickson wrote:   
   >>> and using   
   >>>   
   >>>    Write('Hello World!',CrtTab,"How are you?");   
   >>>   
   >>> instead?   
   >>>   
   >> Because you'll get a fixed block of 8 spaces which won't behave the   
   >> same as tab - even though that may sometimes display as 8 spaces.   
   >   
   > (untested brain experiment. This is kind of dangerous. Implementations   
   > that calculate the whole string instead of per item will fail)   
   >   
   > {$ifndef FPC}   
   > const screenwidth=80;   
   > {$endif}   
   >   
   > function crttab:string;   
   >   
   > var x,y: integer;   
   >   
   > begin   
      
   crttab := ''; {??}   
      
   >  x:=(wherex+8) and not 7;  y:=wherey;   
   >  if x>screenwidth then   
   >   begin   
   >    dec(x,screenwidth); inc(y);   
   >  end;   
   >  gotoxy(x,y);   
   > end;   
   >   
   > write('Hello World!',crttab,'How are you?');   
      
   It did not work for me using TP7 running XP Sp1. I am not sure about   
   TPW.   
   On the net there was info that gotoxy, wherex, ... were still part of   
   Delphi 1. They are not with Delphi 6.   
      
   i came up with the following which works in 1st version but not in 2nd.   
   Obviously the TP7 compiler does not serialize write-statement as   
   expected. All "functions" (damn sideffects ;)) seem to be evaluated b4   
   the output is started.   
      
   - - - -   
      
   program wintab; {TP 7}   
      
   uses crt;   
      
   function wtab : string;   
   begin   
     wtab := copy('        ',1,(8 - (pred(wherex) and 7)));   
   end;   
      
   begin   
     writeln('Using whereX to simulate TAB');   
     writeln;   
      
   write('12345678901234567890123456789012345678901234567890123456789012345   
   678901234567890');   
     {works here : }   
     write('a234567');   
     write(wtab, 'b');   
     write(wtab, 'c');   
     write(wtab, 'asssdasdasddasd');   
     write(wtab, 3.0:4:2);   
     write(wtab, 'd');   
     writeln;   
      
     writeln('In ONE statement: ');   
     writeln;   
      
   write('12345678901234567890123456789012345678901234567890123456789012345   
   678901234567890');   
     {does not work here: }   
     write('a234567',   
           wtab, 'b',   
           wtab, 'c',   
           wtab, 'asssdasdasddasd',   
           wtab, 3.0:4:2,   
           wtab, 'd');   
     writeln;   
     write('OOOPS :) - Press ENTER');   
     readln   
   end.   
      
   - - - -   
      
   greetings   
   jo   
      
   --   
   http://radio789.net.ms - Radio 789 - We play it ALL   
   Radiostream: http://stream789.net.ms   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca