How would I be able to make my "tab stops" user selectable?
How would I be able to make my "tab stops" user selectable?
I am writing to a dot matrix printer using Epson Esc- codes.
write(F,#27 + 'D' + #7 + #23 + #46 + #61 + #0); // Set horizontal tabs
How would I change this code to make one or more of the tab stops "variable"?
I am writing to a dot matrix printer using Epson Esc- codes.
write(F,#27 + 'D' + #7 + #23 + #46 + #61 + #0); // Set horizontal tabs
How would I change this code to make one or more of the tab stops "variable"?
Didn't think you use dot matrix printers anymore... have programmed HP laser printers though for 10 years ago ...
ReplyDeleteRik van Kekem
ReplyDeleteI can already set horizontal tabs.
What I am looking for is how to set them, not as fixed tabs but at run time by user input.
O, I misunderstood then. Something like this would do it:
ReplyDelete//--------
var
Num, I: integer;
Tabs: array of integer;
begin
Write('Number of tabs: ');
Readln(Num);
if Num > 16 thhn
num := 16;
SetLength(Tabs, Num);
for I := 0 to Num - 1 do
begin
Write('Tabnumber ', I + 1, ': ');
Readln(Tabs[I]);
end;
Write(#27 + 'D'); // begin tabsetting
for I := 0 to Num - 1 do Write(Chr(Tabs[I]));
Write(#0); // end tabsetting
//--------
You could also just ask the user to enter all the tabs ending with 0. In that case you could increase the tab array with SetLengt(Tabs, Length(Tabs) + 1); in the loop until the user enters 0. (All this assuming you're working with a console program and not a GUI)