Results 1 to 4 of 4

Thread: The form with tabs in your script. How To.

  1. #1
    Join Date
    May 2012
    Location
    Moscow, Russia
    Posts
    661
    Mentioned
    35 Post(s)
    Quoted
    102 Post(s)

    Default The form with tabs in your script. How To.

    Hey, That is very simple.

    In pascal script embended a class: TPageControl. That class is implemented the your tabs container. Tab implemented in TTabSheet class. So, the TPageControl and TTabSheet its all you need for create the you personal form with tabs for you script.

    Code example:
    Simba Code:
    var
       DsgnForm:TForm;
       P: TPageControl;
       Tab1,tab2: TTabSheet;
       TButton0: TButton;
    const
       default = 'Comic Sans MS';



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


    procedure InitForm;
    begin
    //DsgnForm\\
      DsgnForm:=TForm.Create(nil);
       with  DsgnForm  do
         begin
           Caption:='DsgnForm';
           Left:=0;
           Top:=0;
           Width:=420;
           Height:=407;
           Font.Name:=default;
           Font.Color:=clDefault;
           Font.Size:=0;
       end;
       P:=TPageControl.Create(DsgnForm);
       with P do
        begin
          Parent:=DsgnForm;
          Left:=0;
          Top:=0;
          Width:=420;
          Height:=407;
        end;
        Tab1:=TTabSheet.Create(P);
        with Tab1 do
        begin
          Caption:='Test1';
          Left:=0;
          Top:=0;
          Width:=420;
          Height:=407;
          Visible:=true;
          PageControl:=P;
        end;
        Tab2:=TTabSheet.Create(P);
        with Tab2 do
        begin
          Caption:='Test2';
          Left:=0;
          Top:=0;
          Width:=420;
          Height:=407;
          Visible:=true;
          PageControl:=P;
        end;
        P.ActivePage := P.Pages[0];
        P.ActivePage := P.Pages[1];

    end;

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


    procedure ShowFormModal;
    begin
       DsgnForm.ShowModal;
    end;


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


    begin
       SafeInitForm;
       SafeShowFormModal;
    end.

    Code is very simple, just look at that. If you need place any other control or TImage on your tab, you need assign to the control parent you tab index in TpageControl.Pages[youtabindex] property.

    Example:
    Simba Code:
    TButton0:=TButton.Create(DsgnForm);
       with  TButton0  do
         begin
           Parent:=P.Pages[0];
           Caption:='TButton0';
           Left:=132;
           Top:=154;
           Width:=75;
           Height:=25;
           OnClick:=@YourClickProcedure;
       end;

    This is all. I hope this can help for anyone.

    Cheers, Cynic.
    Per aspera ad Astra!
    ----------------------------------------
    Slow and steady wins the race.

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Thank you

  3. #3
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Definitely gonna use this!

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  4. #4
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Any help from anyone would be awesome:

    Is there any way I can change the font options of the tab caption? I tried Caption.Font.Style and Font.Style, but there doesn't seem to be such option I just want to make it bold without changing the main font style! I'm sure it's easy, and I'm just over-looking it.

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •