Results 1 to 8 of 8

Thread: Readln Question

  1. #1
    Join Date
    Aug 2009
    Posts
    164
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Readln Question

    Can i put a default answer into a readln so that if the user wanted to use the same thing most of the time they wouldn't have to keep reentering it? (they would still be able to edit the text and put a new answer if needed)


  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I don't think so.. But you could make your own readln function with your own form

  3. #3
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    don't be intimidated by the form, I never knew forms until recently and it's really quick and easy to learn once you try. Just learn how to make a form all you need is a TEdit, TLabel, and TButton, 3 simple things to do that. Good luck if you decide to learn this, I hope you do as it's quite easy and not that time consuming to learn, but if you really can't/won't make it on your own then I could help you out probably.

  4. #4
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    You sure can.
    SCAR Code:
    TEdit.Text := 'Default text here';
    If you wanted to save it for the next time it's opened, you can use the WriteINI function. I'm not sure if there's a better way, but that's how I know how to do it.
    Last edited by Coh3n; 02-17-2010 at 04:45 AM.

  5. #5
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    yea, but that's for a form Coh3n, he's talking bout ReadLn();, which I don't think you can edit the text, I think you need to make your own form and add in the default text since ReadLn doesn't have default text.

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Baked0420 View Post
    yea, but that's for a form Coh3n, he's talking bout ReadLn();, which I don't think you can edit the text, I think you need to make your own form and add in the default text since ReadLn doesn't have default text.
    Oh lol, then I'm confused about what he's trying to accomplish.

  7. #7
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    He wants the Readln to have default text in the box, but since Readln is a form "in" the function in scar, you can't edit it to put in TEdit.Text as far as I know, at least not without recreating the form, which would be quite simple since it's only a TButton, TEdit, and TLabel, and then he could just add into the TEdit a text.

  8. #8
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    var
      s, TheVariableYouWant: string;
    begin
      s := ReadINI('parameterthings here');
      if s <> '' then
      begin
        writeLn('Some settings are saved already');
        TheVariableYouWant := s;
      end else
      begin
        writeLn('Settings are empty, asking them now');
        TheVariableYouWant := ReadLn('Say something noob');
        WriteINI('parameterthings', TheVariableYouWant);
      end;
    end;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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