SRL Archive - Help and Support

Forms


muna580

2006-07-04 15:08:21

I have almost completed my first script ever. I just had couple of questions.

In forms, when you create "Edit" type of boxes, is it possible to have it set to only accept intergers instead of text?

Also, in the forms, I am having usersput put in their user/pass, and other stuff. How do I like use those inputs in my script as variables.

realrune

2006-07-04 15:25:23

From: muna580
I have almost completed my first script ever. I just had couple of questions.

In forms, when you create "Edit" type of boxes, is it possible to have it set to only accept intergers instead of text?

Also, in the forms, I am having usersput put in their user/pass, and other stuff. How do I like use those inputs in my script as variables.


No, but you can use the function StrToInt to convert strings into integers and IntToStr to convert integers into strings.

Ex :

program new;

Var
Test : String;
I : Integer;

begin
Test := '1';
I := StrToInt(Test);
writeln(IntToStr(I));
end.

The other part… just change the var name and edit1 to whatever the editbox is that you want to get the info out of.

User := Edit1.Txt;

muna580

2006-07-04 15:41:46

Having a little trouble with script and the form. can someone elp me over aim or msn?

Bego

2006-07-04 16:49:11

MSN please.

muna580

2006-07-04 17:16:45

Bego, I added u on msn, its [email]teentalkcentral@hotmail.com[/email]

Cruel

2006-07-04 17:17:41

From: muna580
In forms, when you create "Edit" type of boxes, is it possible to have it set to only accept intergers instead of text?

Sure… here's some code that'll only display numbers 0-9.
procedure EditChange(sender: TObject);
var
i:Integer;
str1:String;
begin
with TEdit(sender) do begin
str1:= Text;
if str1 <> '' then
for i:= 1 to Length(str1) do
case Ord(str1[i]) of
48,49,50,51,52,53,54,55,56,57: ;
else Delete(str1,i,1);
end;
Text:= str1;
SelStart:= Length(str1);
end;
end;
Put it on the TEdit's OnChange event, like this:
Edit1.OnChange:= @EditChange;
Not only will it stop anyone from typing any other characters, but it'll also convert anything you paste in there or something.
For instance, you could paste 'fdg8df6dhg687' into the edit control and it'd only show '86687'.

muna580

2006-07-04 17:31:57

I got everything fixed except for 2 things.

I have two buttons in my form, one is Start and another one is Cancel.

I have this procedure if you click Start
procedure EndForm(sender : TObject);
begin
WindowTitle.ModalResult := mrOk;
end;


After it clickst start, it continues with the next step in my mainloop

the probelm is that when i click on the X on the top of the window, it doens't terminat ethe script, it keeps going just as if I clicked Start.

The second problem I am having is hard to show u without me sending u the whole script. IF you talk to me on msn, i will send u script