Results 1 to 6 of 6

Thread: Form Question -

  1. #1
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Form Question -

    Hiya, Everyone. Well, I'm have a little trouble with a form part of mine and I was wondering if I could get some help with it.

    I want to make it something like this.. When the user inputs letters or numbers into Edit1, and hit 'Save' or something, it will be made into a String. So basically what I'm looking for is a way to make Edit1's content into a String for use in the script.

    Thanks in advance.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    There used to be something meaningful here.

  3. #3
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Risk View Post
    Hiya, Everyone. Well, I'm have a little trouble with a form part of mine and I was wondering if I could get some help with it.

    I want to make it something like this.. When the user inputs letters or numbers into Edit1, and hit 'Save' or something, it will be made into a String. So basically what I'm looking for is a way to make Edit1's content into a String for use in the script.

    Thanks in advance.
    To do so you can set a variable to Edit1.Text.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    @ Frement: Yeah, I was reading that but it is uncompleted. It also does not explain how to make Edit1 into a String.

    Thanks though.

    @ Sex :

    I'll try that now, thanks.

    Edit01: Can I please get an example on what you meant by that, Sex?
    Last edited by RISK; 01-20-2010 at 02:41 PM.

  5. #5
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Risk View Post
    @ Frement: Yeah, I was reading that but it is uncompleted. It also does not explain how to make Edit1 into a String.

    Thanks though.

    @ Sex :

    I'll try that now, thanks.

    Edit01: Can I please get an example on what you meant by that, Sex?
    SCAR Code:
    program New;
    var
      frmDesign : TForm;
      Edit1 : TEdit;
      Button1 : TButton;
      s : string;

    procedure SaveAndExit(sender: TObject);
    begin
      s := Edit1.Text;
      frmDesign.ModalResult := mrOk;
      Writeln(Format('The variable s was set to Edit1.Text: %s', [s]));
    end;

    procedure InitForm;
    begin
      frmDesign := CreateForm;
      frmDesign.Left := 250;
      frmDesign.Top := 114;
      frmDesign.BorderStyle := bsToolWindow;
      frmDesign.Caption := 'Example';
      frmDesign.ClientHeight := 55;
      frmDesign.ClientWidth := 92;
      frmDesign.Color := clBtnFace;
      frmDesign.Font.Color := clWindowText;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.Visible := False;
      frmDesign.PixelsPerInch := 96;
      Edit1 := TEdit.Create(frmDesign);
      Edit1.Parent := frmDesign;
      Edit1.Left := 8;
      Edit1.Top := 8;
      Edit1.Width := 81;
      Edit1.Height := 21;
      Edit1.TabOrder := 8;
      Button1 := TButton.Create(frmDesign);
      Button1.Parent := frmDesign;
      Button1.Left := 8;
      Button1.Top := 32;
      Button1.Width := 81;
      Button1.Height := 20;
      Button1.Caption := 'Save and Exit';
      Button1.TabOrder := 9;
      Button1.OnClick := @SaveAndExit;
    end;

    procedure SafeInitForm;
    var
      v : TVariantArray;
    begin
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v : TVariantArray;
    begin
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
      FreeForm(frmDesign);
    end.
    Learn from that. If you have any more questions, add me on MSN: kyle@kyleis1337.info.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  6. #6
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thank you very much, Sex, really appreciate your help! Learned how to do what I needed to do. Now I can continue making my form.
    Last edited by RISK; 01-21-2010 at 02:50 AM.

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
  •