Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help on a variety of things

newbiprogramernewbiprogramer Posts: 9Member
as my name states i am a newbie programer. all i am useing is turbo pascal 1.5. i am taking a course at my highschool and i have outpaced my teacher and the help is realy confusing to use so i hope that i can get help here.

1) when using message boxes:
i know the format is (0,'Text', 'Caption', MB_whatever); but it says in the help you can use two MB_whatevers and i tried every thing i could think of but it wouldnt work.

2) useing the readkey function if the backspace button is pressed it activate the readkey. but i dont know how to specificly tell when it is pressed. example: i was making a calculator that when you pressed any button besides the numbers and the different opperation keys it popped up a message box, but i wanted the backspace key to delete the last inputed number.

3) if the codeing is not to complicated, how do you add color the output?

for now that is it. if i think of more i will post again.

Thanks in advance for your help.

Comments

  • ManningManning Posts: 1,621Member
    : 1) when using message boxes:
    : i know the format is (0,'Text', 'Caption', MB_whatever); but it says in the help you can use two MB_whatevers and i tried every thing i could think of but it wouldnt work.

    In Delphi I just add them together. For example:

    mb_IconQuestion + mb_YesNo

    If that doesnt work, maybe try the AND or OR operators.

    : 2) useing the readkey function if the backspace button is pressed it activate the readkey. but i dont know how to specificly tell when it is pressed. example: i was making a calculator that when you pressed any button besides the numbers and the different opperation keys it popped up a message box, but i wanted the backspace key to delete the last inputed number.

    Backspace is represented by #8 (ascii 8). At the bottom of this message I'll add a program that you can use the determine the ascii value of any keys on the keyboard.

    :
    : 3) if the codeing is not to complicated, how do you add color the output?

    TextColor() and TextBackground() are 2 procedures you can use to change the text attributes. You can also directly modify the TextAttr variable. It is much more convenient but a little more complex.

    :
    : for now that is it. if i think of more i will post again.
    :
    : Thanks in advance for your help.
    :


    This will not compile directly with the version of pascal you use. You should be safe replacing nReadKey with plain old ReadKey and FastWrite with a GotoXY/WriteLn combo.

    [code]
    program MannKey;

    uses
    Crt, MannUtls, VPUtils;

    var
    Ch: Char;
    S: String;
    begin
    HideCursor;
    ClrScr;
    WriteLn;
    WriteLn(' Press A Key (ESC To Quit)');
    repeat
    Ch := nReadKey;
    if (Ch = #0) then
    begin
    Ch := nReadKey;
    S := '#0 + #' + IntToStr(Ord(Ch));
    end else
    S := '#' + IntToStr(Ord(Ch));
    FastWrite('You Pressed: ' + S + ' ', 2, 4, 15);
    until (Ch = #27);
    GotoXY(1, 5);
    ShowCursor;
    end.
    [/code]
Sign In or Register to comment.