Results 1 to 8 of 8

Thread: Redraw a Form

  1. #1
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default Redraw a Form

    Hey!
    Does SCAR have a function to redraw a form window (Like while a (runescape) script runs.).

    Because windows freeze, when theyre not redrawn, and i'm searching for a ways to prevent that :' D.

    ~caused

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Re-draw a form window? You mean to overwrite it?

  3. #3
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    TForms have a property called repaint. That may be what you want.


  4. #4
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    TForms have a property called repaint. That may be what you want.
    They do ?. How does that Work ?.

    I dont think a property would be the sollution though.

    //Trying out the repaint property :3

    Doesnt work .
    I only would need something that would redraw/paint the window. The problem is:

    Once a "larger" function is called the window freezes, and it doesnt seem to react on ".Repaint" anymore.

    ~caused

  5. #5
    Join Date
    Jun 2007
    Location
    #SRL
    Posts
    200
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    nope; what you want to do is change the way you're showing the form; right now you're probably using MyForm.ShowModal; well, just change that to MyForm.Show; and you'll be good!

    (btw, you don't need to use the .repaint or .refresh methods when you use .show, just change .showmodal to .show and it will "multithread" [sort of] your SCAR script)
    Quote Originally Posted by IRC
    <Wizzup> 5
    <Wizzup> 4
    <Wizzup> 43
    <Wizzup> shit
    <Wizzup> 5
    <Wizzup> 4
    <Wizzup> 3
    <Wizzup> 1
    <Wizzup> offblast

  6. #6
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by Tootoot222 View Post
    nope; what you want to do is change the way you're showing the form; right now you're probably using MyForm.ShowModal; well, just change that to MyForm.Show; and you'll be good!

    (btw, you don't need to use the .repaint or .refresh methods when you use .show, just change .showmodal to .show and it will "multithread" [sort of] your SCAR script)
    With .show, the window freezes immediately, before anything has happened :O.

    Heres an example Programm.
    I want it to react While it "waits";

    Code:
    program New;
    var
      frmDesign : TForm;
      Button1 : TButton;
      
      procedure buttonclick(sender: TObject);
    begin
      Writeln('Button pressed!');
      wait(5000); // Window should still react and beeing repainted while it waits 
      
    procedure InitForm;
    begin
     frmDesign := CreateForm;
    frmDesign.Left := 250;
    frmDesign.Top := 114;
    frmDesign.Width := 696;
    frmDesign.Height := 480;
    frmDesign.Caption := 'frmDesign';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := True;
    frmDesign.PixelsPerInch := 96;
    Button1 := TButton.Create(frmDesign);
    Button1.Parent := frmDesign;
    Button1.Left := 104;
    Button1.Top := 160;
    Button1.Width := 497;
    Button1.Height := 169;
    Button1.Caption := 'Do Lots of Stuff';
    Button1.TabOrder := 8;
    
    Button1.OnClick:= @buttonclick;
    end;
    
    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;
    
    procedure ShowFormModal;
    begin
      frmDesign.Show;
    end;
    
    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;
    
    
    begin
    
    
      SafeInitForm;
      SafeShowFormModal;
       
       repeat
       wait(100);
       until(false=true);
    end.

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    repeat
       wait(100);
       until(false=true);
    ?.
    Thats going to result in false anyway. Moreover, you need to add an 'end' as you missed one.

  8. #8
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    doesnt matter =). I made it multithreading with some timer now, works brilliant :3

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
  •