Results 1 to 7 of 7

Thread: Need help with reflection forms.

  1. #1
    Join Date
    Sep 2015
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default Need help with reflection forms.

    Hello!

    I've been trying to make a form for my script but I can't find a way to do it with reflection. I was told to use ezForm but I want to make one from scratch.
    So the thing is...form makes in simba returns code which can be only used on PascalScript interpreter but I need it on lape for use with lape reflection.

    This is the code of simba form editor:

    Code:
    var
      MainForm:TForm;
    const
      default = 'Comic Sans MS';
    
    
    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;
    
    procedure InitForm;
    begin
    //MainForm\\
     MainForm:=TForm.Create(nil);
      with MainForm do
        begin
          Caption:='Script setup';
          Left:=269;
          Top:=432;
          Width:=600;
          Height:=240;
          Font.Name:=default;
          Font.Color:=clDefault;
          Font.Size:=0;
      end;
    end;
    
    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v); 
    end;
    
    procedure ShowFormModal;
    begin
      MainForm.ShowModal;
    end;
    
    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;
    
    begin
      SafeInitForm; 
      SafeShowFormModal;
    end.

    What I modified for lape:
    Code:
    var
      MainForm : TForm;
    
    const
      default = 'Comic Sans MS';
    
    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;
    
    procedure InitForm;
    var
      Font : TFont;
    begin
    //DsgnForm\\
     MainForm.Init(nil);
     Font.Init;
     Font.SetDefault;
      with MainForm do
        begin
          setCaption('Script setup');
          setLeft(174);
          setTop(307);
          setWidth(320);
          setHeight(240);
      end;
    end;
    
    procedure ShowFormModal;
    begin
      MainForm.ShowModal;
    end;
    
    begin
      InitForm;
      ShowFormModal;
    end.
    When I try to run it it gives me simba error:
    Code:
    Program exception! 
    Stacktrace:
    
    Exception class: EThread
    Message: CheckSynchronize called from non-main thread "$1A74"
      $004596E1
      $0050A33D
      $0041F803
      $0083411F
      $0075DEC2
      $00600BC3
      $004590F8
    Simba Version: 1100
    I'm guessing I don't load it correctly and I can't find a good example which would show me how to do it.

    Thanks for your help in advance
    Last edited by kakadudl; 03-20-2016 at 05:07 PM.

  2. #2
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    Again, on my phone (will try when I get home), but try:
    Simba Code:
    initForm;
    sync(showFormModal);
    end;




    Skype: obscuritySRL@outlook.com

  3. #3
    Join Date
    Sep 2015
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    Again, on my phone (will try when I get home), but try:
    Simba Code:
    initForm;
    sync(showFormModal);
    end;
    Tried that it only gives me cannot invoke identifier error

  4. #4
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    Simba Code:
    var
      MainForm:TForm;

    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;

    procedure InitForm;
    begin
    //MainForm\\
      MainForm.Init(nil);
      with MainForm do
      begin
          SetCaption('Script setup');
          SetLeft(269);
          SetTop(432);
          SetWidth(600);
          SetHeight(240);
          //~ ...
      end;
    end;

    procedure ShowForm; native;
    begin
      MainForm.showModal();
    end;

    begin
      InitForm;
      Sync(ShowForm);
    end.

    Still, I'd suggest eZForm. :P.




    Skype: obscuritySRL@outlook.com

  5. #5
    Join Date
    Sep 2015
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    Simba Code:
    var
      MainForm:TForm;

    procedure YourClickProcedure(Sender: TObject);
    begin
      ShowMessage('click');
    end;

    procedure InitForm;
    begin
    //MainForm\\
      MainForm.Init(nil);
      with MainForm do
      begin
          SetCaption('Script setup');
          SetLeft(269);
          SetTop(432);
          SetWidth(600);
          SetHeight(240);
          //~ ...
      end;
    end;

    procedure ShowForm; native;
    begin
      MainForm.showModal();
    end;

    begin
      InitForm;
      Sync(ShowForm);
    end.

    Still, I'd suggest eZForm. :P.
    Thank you very much

  6. #6
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    Unfortunately, a lot of the old tutorials (which I'm assuming you were using) no longer apply and there's really no docs on newer material. If my date-plans tonight fall through, maybe I'll write a newer form tutorial (without eZF). .

    For now, if you want an idea of adding components:
    https://github.com/ObscuritySRL/eZFo...imba#L149-L450
    Last edited by Obscurity; 03-20-2016 at 08:11 PM.




    Skype: obscuritySRL@outlook.com

  7. #7
    Join Date
    Sep 2015
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    I was looking at ineedbot +'s AIO fisher because I couldn't find anything else but it's kinda messed up with all other functions. If you make a tutorial I'll surely read it. Thanks for all the useful info tho

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
  •