Results 1 to 3 of 3

Thread: Form help.

  1. #1
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Form help.

    i get this error whenever i try to run this:
    [Runtime Error] : Exception: Cannot make a visible window modal in line 158 in script

    SCAR Code:
    var
      frmDesign : TForm;
      Fill : TLabel;
      This : TLabel;
      Woot : TLabel;
      Ok : TButton;
      TopButton : TEdit;
      BottomButton : TEdit;
      NickName : TEdit;
      Username, Password, Nick : String;
     
    procedure StartClick(sender: TObject);
    begin
      Username := TopButton.Text;
      Password := BottomButton.Text;
      Nick := NickName.Text;
      frmDesign.ModalResult:= mrOk;
    end;

    procedure FormStuff;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 250;
    frmDesign.Top := 114;
    frmDesign.Width := 220;
    frmDesign.Height := 278;
    frmDesign.Caption := 'frmDesign';
    frmDesign.Color := clBlack;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := True;
    frmDesign.PixelsPerInch := 96;
    Fill := TLabel.Create(frmDesign);
    Fill.Parent := frmDesign;
    Fill.Left := 40;
    Fill.Top := 24;
    Fill.Width := 34;
    Fill.Height := 32;
    Fill.Alignment := taCenter;
    Fill.Caption := 'Fill';
    Fill.Font.Color := clWhite;
    Fill.Font.Height := -29;
    Fill.Font.Name := 'MS Sans Serif';
    Fill.Font.Style := [];
    Fill.ParentFont := False;
    Fill.Layout := tlCenter;
    This := TLabel.Create(frmDesign);
    This.Parent := frmDesign;
    This.Left := 80;
    This.Top := 24;
    This.Width := 52;
    This.Height := 32;
    This.Alignment := taCenter;
    This.Caption := 'This';
    This.Font.Color := clWhite;
    This.Font.Height := -29;
    This.Font.Name := 'MS Sans Serif';
    This.Font.Style := [];
    This.ParentFont := False;
    This.Layout := tlCenter;
    Woot := TLabel.Create(frmDesign);
    Woot.Parent := frmDesign;
    Woot.Left := 136;
    Woot.Top := 24;
    Woot.Width := 40;
    Woot.Height := 32;
    Woot.Alignment := taCenter;
    Woot.Caption := 'Out';
    Woot.Font.Color := clWhite;
    Woot.Font.Height := -29;
    Woot.Font.Name := 'MS Sans Serif';
    Woot.Font.Style := [];
    Woot.ParentFont := False;
    Woot.Layout := tlCenter;
    Ok := TButton.Create(frmDesign);
    Ok.Parent := frmDesign;
    Ok.Left := 56;
    Ok.Top := 184;
    Ok.Width := 105;
    Ok.Height := 25;
    Ok.Caption := 'Ok';
    Ok.Font.Color := clWhite;
    Ok.Font.Height := -11;
    Ok.Font.Name := 'MS Sans Serif';
    Ok.Font.Style := [];
    Ok.ParentFont := False;
    Ok.TabOrder := 8;
    TopButton := TEdit.Create(frmDesign);
    TopButton.Parent := frmDesign;
    TopButton.Left := 48;
    TopButton.Top := 80;
    TopButton.Width := 121;
    TopButton.Height := 21;
    TopButton.Color := clGreen;
    TopButton.Font.Color := clWhite;
    TopButton.Font.Height := -11;
    TopButton.Font.Name := 'MS Sans Serif';
    TopButton.Font.Style := [];
    TopButton.ParentFont := False;
    TopButton.TabOrder := 9;
    TopButton.Text := 'TopButton';
    BottomButton := TEdit.Create(frmDesign);
    BottomButton.Parent := frmDesign;
    BottomButton.Left := 48;
    BottomButton.Top := 112;
    BottomButton.Width := 121;
    BottomButton.Height := 21;
    BottomButton.Color := clGreen;
    BottomButton.Font.Color := clWhite;
    BottomButton.Font.Height := -11;
    BottomButton.Font.Name := 'MS Sans Serif';
    BottomButton.Font.Style := [];
    BottomButton.ParentFont := False;
    BottomButton.TabOrder := 10;
    BottomButton.Text := 'BottomButton';
    NickName := TEdit.Create(frmDesign);
    NickName.Parent := frmDesign;
    NickName.Left := 48;
    NickName.Top := 144;
    NickName.Width := 121;
    NickName.Height := 21;
    NickName.Color := clGreen;
    NickName.Font.Color := clWhite;
    NickName.Font.Height := -11;
    NickName.Font.Name := 'MS Sans Serif';
    NickName.Font.Style := [];
    NickName.ParentFont := False;
    NickName.TabOrder := 11;
    NickName.Text := 'NickName';
    end;

    procedure ShowForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('FormStuff', v);
    end;

    procedure ShowformModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowformModal', v); // this is the line
    end;

    begin
      ShowForm;
      SafeShowModal;
    end.

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    change "frmDesign.Visible := True;" to "frmDesign.Visible := False;"
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    argh, i always forget that, thanks.

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
  •