SRL Archive - OSR Help

Readln Question


scuz 10

2010-02-12 18:02:07

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)


Gu3st...

2010-02-13 03:48:46

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

Baked0420

2010-02-16 23:33:59

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.

Coh3n

2010-02-16 23:43:09

You sure can. :)

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.

Baked0420

2010-02-17 06:31:05

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.

Coh3n

2010-02-17 11:51:31

From: Baked0420
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. :o

Baked0420

2010-02-17 12:16:52

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.

marpis

2010-02-17 13:23:38


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;