Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 73

Thread: ezForm

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

    Default

    Updated eZForm (linked it on Github now). Will update all of the examples tomorrow. It's safe to use as an include now, as I don't expect too much to change in the future that would break backward compatibility. Just adding properties, controls, etc.

    Bed time!

  2. #27
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    dumb question; this is compatible with osrs yeah?

    <------------------>



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

    Default

    Quote Originally Posted by AFools View Post
    dumb question;
    Works with anything, as it is a separate include from reflection, ogLib, SRL, etc.

    Edit:

    All examples have been added to the original post and updated for the new eZForm. I've also recently pushed an update which allows for methods to be called on arrays of components. Check it out here.

    Edit 2:

    I've removed radioButtons and added progressBars and some useful methods. Check it out here. An example progressBar has been added to the original post.
    Last edited by Obscurity; 10-16-2015 at 10:00 PM.




    Skype: obscuritySRL@outlook.com

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

    Default

    :: Automated Message ::
    Added eZForm.addImageURL() and More


    ObscuritySRL updated on Tuesday, October 20, 2015

    66 additions, 11 deletions.

    Added eZForm.addImageURL(). If the URL passed is an image, even if it
    doesn't end in GIF, JPG, etc, it will automatically be downloaded and
    added to the form at the specific point with the specified dimensions.

    Added tZComponent.prop('handle').
    A total of 1 files were affected:




    Last edited by Obscurity; 10-27-2015 at 02:13 AM.

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

    Default

    :: Automated Message ::
    Added Passwords, Image URLs, Methods, and More!


    ObscuritySRL updated on Monday, October 26, 2015

    181 additions, 72 deletions.

    eZForm now requires ProSocks. This went without question, as various
    functions, such as getPage() and rewriteFile() would cause access
    violations when used in event handlers. See initial post of the eZForm
    thread for more details.

    Changed various variable names to be consistent with their methods.

    Added the password property and methods to edits and memos. An example
    has been added to the initial post of the eZForm thread.

    Added the handle property and methods to all components.

    Added the src property and methods to images. An example has been added
    to the initial post of the eZForm thread.

    Removed tZForm.addImageURL(). If a URL, requiring the preceding http://,
    is passed to tZForm.addImage(), it'll automatically download and add the
    image.
    A total of 1 files were affected:





  6. #31
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    ...


    Simba Code:
    getTClient().MFiles.RewriteFile(.....);

    //OR

    getTClient().getMFiles().RewriteFile(....); //I don't have Simba installed to test which of the above is correct..

    Will work from any thread. I don't think there's a way to do it with Sockets though..

    These are the only interfaces I see that are exported: https://github.com/MerlijnWajer/Simb...lient.pas#L148
    Last edited by Brandon; 10-28-2015 at 01:59 AM.
    I am Ggzz..
    Hackintosher

  7. #32
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    This is awesome. Can you call multiple forms in a single script? For example, I could call a form to declarePlayers with, close that form on submit, then bring up a live form for the user to interact with live?

    EDIT: There seems to be a conflict with ogLib:

    Simba Code:
    program new;
    {$i ogLib/lib/core/core.simba}
    {$i ezForm.simba}

    begin
    end.

    Throws a too many parameters error inside ezForm.simba, line 162: if length(_StringArray) then
    Last edited by Lama; 11-02-2015 at 05:39 PM.

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

    Default

    Quote Originally Posted by Lama View Post
    This is awesome. Can you call multiple forms in a single script? For example, I could call a form to declarePlayers with, close that form on submit, then bring up a live form for the user to interact with live?

    EDIT: There seems to be a conflict with ogLib:

    Simba Code:
    program new;
    {$i ogLib/lib/core/core.simba}
    {$i ezForm.simba}

    begin
    end.

    Throws a too many parameters error inside ezForm.simba, line 162: if length(_StringArray) then
    I've got that error too, not sure how I fixed it but my scripts work with ogLib now. May even have been something as dumb as restarting Simba.

    I didn't add multiple forms because I wanted it to be easy for everyone to use - and having never used SPF, I didn't personally think there'd be much demand for it.

    I want eZForm to reflect the community here. If people want, or think that multiple forms would be useful, I'd be very happy to add them.

    Should add a poll to the OP. :-).




    Skype: obscuritySRL@outlook.com

  9. #34
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    I've got that error too, not sure how I fixed it but my scripts work with ogLib now. May even have been something as dumb as restarting Simba.

    I didn't add multiple forms because I wanted it to be easy for everyone to use - and having never used SPF, I didn't personally think there'd be much demand for it.

    I want eZForm to reflect the community here. If people want, or think that multiple forms would be useful, I'd be very happy to add them.

    Should add a poll to the OP. :-).
    Well, not necessarily have multiple forms per se, but like, un-show the one and only, modify it, then re-show. Would something like work?

    EDIT: So I'm just here, finaegling with the too many parameters error and I stumbled upon a fix(?)

    Simba Code:
    program new;
    {$DEFINE SRLCOMPATIBILITY}
    {$i srl-6/srl.simba}
    {$i ezForm.simba}
    {$i ogLib/lib/core/core.simba}

    begin
    end.
    This throws no errors.

    I guess the order in which you include matters?
    Last edited by Lama; 11-02-2015 at 07:09 PM.

  10. #35
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

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

    Default

    A heads up - I'm making eZForm support multiple forms. This will require some script updates. I'll explain.

    After discussing it with some people, I had two approaches:

    Option 1:
    Simba Code:
    eZForm.new('First form');
    eZForm.new('Second form');

    //~ ...

    eZForm[0].find('#SomeCheckbox')[0].checked(true);

    Option 2:
    Simba Code:
    var
      myForm:eZForm;
      mySecondForm:eZForm;

    begin
      myForm.create('First form');
      mySecondForm.create('Second form');

    //~ ...

    myForm.find('#SomeCheckbox')[0].checked(true);

    I've decided to go with option 2, as it seemed to be the general preference. For those of you with scripts using eZForm, this will only mean using eZForm as a type now. Should be a very easy update for you, not so much for me. :P.

    Edit - It's coming along great (no thanks to Lama):


    Added a lot of methods to eZForm and such! It's crazy-customizable now! Auto-detects and adds padding/adjust size, etc!
    Last edited by Obscurity; 11-03-2015 at 03:51 AM.




    Skype: obscuritySRL@outlook.com

  12. #37
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    (no thanks to Lama)
    Hey now, let's not get too hasty here.



    I think I'm helping a lot.

    Bring on the innovation.
    Last edited by Lama; 11-03-2015 at 05:16 AM.

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

    Default

    :: Automated Message ::
    Multi-form Support, Added Methods, Etc


    ObscuritySRL updated on Tuesday, November 11, 2015

    653 additions, 584 deletions.

    Added support for multiple forms. Forms must be assigned to variables,
    using the eZForm type, and created using the eZForm.create() method.
    Size and padding will automatically be calculated.

    tZComponent and tZComponentArray have been renamed to eZElement and
    eZElementArray.

    Elements that don't support height, such as combobox, edit, etc, no
    longer require it as a parameter.

    Renamed handle methods and variables to ID.

    Simplified eZElement.be() and eZElement.prop() methods, greatly
    decreasing include size.

    Added numerous methods to the eZForm type, matching several element
    methods. For example, eZForm.disabled().

    Added various methods, such as eZElement.cols(), eZElement.disabled(),
    eZElement.id(), eZElement.password(), eZElement.tagName(),
    eZElement.title(), etc.

    Added the style property to elements. This returns the control's font
    color, size, style (bold, italic, etc).

    Changed combobox, edit, and memo methods to use the value property
    instead of text.

    The tObject.toComponent() method has been renamed to
    tObject.toElement().

    Image URLs now support HTTPS URLs.
    A total of 1 files were affected:








    Edit - Examples in the original post have been updated to the new eZForm.

    A massive apology for the many changes, not backward compatible, but they were required to make eZForm support multiple forms, which seemed to be the general preference. I think you'll find they were worth it. .

    Due to a temporary glitch, removing elements from a visible form has been temporarily disabled. For some reason, it's causing eZForm to crash. I'll look into this more as I get time.

    If you aren't happy with the calculated size, the eZForm.height() and eZForm.width() methods are your friend.

    eZElement.hide(), eZElement.show(), and eZElement.visible() methods, when called from an event handler, are causing unexpected results when changing the visible state of an element. Again, fixed as I get time.

    It was damn-near rewritten, so if I forgot something, post!
    Last edited by Obscurity; 11-04-2015 at 03:30 AM.




    Skype: obscuritySRL@outlook.com

  14. #39
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Wooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooo! Can't wait to put this to good use! +Rep
    Last edited by Lama; 11-04-2015 at 04:24 AM.

  15. #40
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

  16. #41
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Nice work @Obscurity;! :-)

    I started on something similar quite a few years ago but never finished, the result of which can be found in the SSRL section, and now pasted here:
    Simba Code:
    {==============================================================================)
    [                       SPL - Simba Presentation Library                       ]
    [                                 version 1.0                                  ]
    [------------------------------------------------------------------------------]
    [                                                                              ]
    (==============================================================================}


    { SSRLers! Currently what is not implemented are the following:
        * SPL_EnableNonButtonEventHandlers (in fact, no events of any kind yet!)
        * SPL_UseLapeOptionalParametres (no need, yet!)
        * SPL_MultipleForms (this is already enabled by default. Atm, not defining this will make no difference)

      Enjoysies! :D }


    {$Define SPL}         // Using SPL?
    {$Define SPL_Prefix}  // Prefix all user-editable identifiers with SPL_?
    {$Define SPL_DisplayErrors}   // Output errors.
    {$Define SPL_CheckForUpdates} // Check for updates to the SPL library?
    {$Define SPL_EnableNonButtonEventHandlers}  // Enable OnClick/OnChange support for events for controls other than the TButton?
    {$Define SPL_UseLapeOptionalParametres}     // Enable Lape optional parametres?
    {$Define SPL_MultipleForms}             // Enable support for multiple form creation?
    {$Define SPL_StringIdentifiers}         // Use strings as identifiers for controls?
    {$Define SPL_Unicode}    // Enable Unicode support.

    {$ifDef Windows}
      {$ifDef Windows8}
        const CRLF = #$D;
      {$else}
        const CRLF = #$D#$A;
      {$endIf}
    {$else}
      const CRLF = #$D;
    {$endIf}

    const
      // DNU prefix == DO NOT USE (i.e. not recommmended to call them inside your scripts)
      DNUSPL_FullName = 'Simba Presentation Library';
      DNUSPL_Acronym = 'SPL';
      DNUSPL_Version = 0.01;

      {$ifDef SPL_Prefix} SPL_ERR_RangeCheck = $1;        {$else} ERR_RangeCheck = $1;        {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_Unassigned = $2;        {$else} ERR_Unassigned = $2;        {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_InvalidIdentifier = $4; {$else} ERR_InvalidIdentifier = $4; {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_InvalidTabControl = $8; {$else} ERR_InvalidTabControl = $8; {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_InvalidTabPage = $10;   {$else} ERR_InvalidTabPage = $10;   {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_InvalidParent = $20;    {$else} ERR_InvalidParent = $20;    {$endIf}
      {$ifDef SPL_Prefix} SPL_ERR_InvalidLength = $40;    {$else} ERR_InvalidLength = $40;    {$endIf}

      DNUSPL_Err_Str_PrependText = '[' + DNUSPL_Acronym + '][ERROR] %s, Form %u: ';
      DNUSPL_Err_Str_ImplicitCast = '[' + DNUSPL_Acronym + '][WARNING] %s, Form %u: Implicit cast made with identifier "%s" down to "%s".';
      DNUSPL_Err_Str_RangeCheck  = DNUSPL_Err_Str_PrependText + 'Out of range.';
      DNUSPL_Err_Str_Unassigned  = DNUSPL_Err_Str_PrependText + 'Unable to validate controls existence';
      DNUSPL_Err_Str_InvalidIdentifier = DNUSPL_Err_Str_PrependText + 'The control with identifier "%s" does not exist.';
      DNUSPL_Err_Str_InvalidTabControl = DNUSPL_Err_Str_PrependText + 'The tab control with identifier "%s" does not exist.';
      DNUSPL_Err_Str_InvalidTabPage = DNUSPL_Err_Str_PrependText + 'The tab with the caption "%s" does not exist.';
      DNUSPL_Err_Str_InvalidParent = DNUSPL_Err_Str_PrependText + 'Invalid parent control "%s".';
      DNUSPL_Err_Str_InvalidLength = DNUSPL_Err_Str_PrependText + '"%s" does not have the same length as "%s".';

      DNUSPL_ComponentPrecede = 'frm' + #$5f;
      {$ifDef SPL_Prefix} SPL_COMP_TabSheet = 0;  {$else} COMP_TabSheet = 0;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_Tab      = 1;  {$else} COMP_Tab      = 1;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_Button   = 2;  {$else} COMP_Button   = 2;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_TextBox  = 3;  {$else} COMP_TextBox  = 3;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_DropDown = 4;  {$else} COMP_DropDown = 4;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_Text     = 5;  {$else} COMP_Text     = 5;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_Picture  = 6;  {$else} COMP_Picture  = 6;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_CheckBox = 7;  {$else} COMP_CheckBox = 7;  {$endIf}
      {$ifDef SPL_Prefix} SPL_COMP_MemoBox  = 8;  {$else} COMP_MemoBox  = 8;  {$endIf}

    type
      Float = Extended;
      TString = {$ifDef SPL_Unicode} UnicodeString; {$else} AnsiString; {$endIf}
      TProcedure = procedure;

      TFormRect = record
        X, Y: Integer;
        Width, Height: Word;
      end;

      TEventHandler = record
        Name: TString;
        ProcToCall: TProcedure;
      end;

    var
      DNUSPLComponentCount: Word;
      DNUSPLFormCount: SmallInt;
      DNUSPLLastError: Cardinal;

      DNUSPLForms: array of TForm;
      DNUSPLProcArray: array of TEventHandler;

    function Rect(const X, Y, Width, Height: Integer): TFormRect;
    begin
      Result.X := X;
      Result.Y := Y;
      Result.Width := Width;
      Result.Height := Height;
    end;

    // Ensures Pascal identifier validity.
    // identifier = letter | underscore { letter | digit | underscore }
    function SPL_Trim(const Str: TString): TString;
    var
      I, strLen: Integer;
      tmpOrd: Byte;
    begin
      strLen := Length(Str);
      for I := 1 to strLen do
        if(not(Str[I] = #32)) then
        begin
          tmpOrd := Ord(Str[I]);

          if(InRange(tmpOrd, 65, 90)) then
            Result := Result + Chr(tmpOrd + 32) else
              if(InRange(tmpOrd, 97, 122) xor (tmpOrd = 95) xor ((InRange(tmpOrd, 48, 57){ and not(I = 1)}))) then
                Result := Result + Str[I];
        end;
    end;

    // Rather self-explanatory.
    function {$ifDef SPL_Prefix} SPL_GetLastError {$else} GetLastSPLError {$endIf}: Cardinal;
    begin
      Result := DNUSPLLastError;
    end;

    // Find's all components and free's them when a form wants to close.
    procedure DNUSPLOnFormCloseQuery(Sender: TObject; var CanClose: Boolean);
    var
      I: Integer;
    begin
      CanClose := False;

      for I := 0 to (TForm(Sender).ComponentCount - 1) do
        TForm(Sender).Components[I].Free;

      CanClose := True;
    end;

    // Unsafely creates a form.
    function DNUSPL_CreateForm(const X, Y, Width, Height: Integer; const ACaption: TString; const ABorderStyle: TBorderStyle): Integer;
    begin
      Inc(DNUSPLFormCount);
      SetLength(DNUSPLForms, DNUSPLFormCount);
      SetLength(DNUSPLProcArray, DNUSPLFormCount);

      Writeln(DNUSPLFormCount);

      DNUSPLForms[DNUSPLFormCount - 1] := TForm.Create(nil);
      DNUSPLForms[DNUSPLFormCount - 1].SetBounds(X, Y, Width, Height);
      DNUSPLForms[DNUSPLFormCount - 1].ClientWidth := Width;
      DNUSPLForms[DNUSPLFormCount - 1].ClientHeight := Height;
      if((X = 0) and (Y = 0)) then
        DNUSPLForms[DNUSPLFormCount - 1].Position := poMainFormCenter;
      DNUSPLForms[DNUSPLFormCount - 1].BorderStyle := ABorderStyle;
      DNUSPLForms[DNUSPLFormCount - 1].Caption := ACaption;
      DNUSPLForms[DNUSPLFormCount - 1].OnCloseQuery := @DNUSPLOnFormCloseQuery;

      if(Assigned(DNUSPLForms[DNUSPLFormCount - 1])) then
        Result := DNUSPLFormCount - 1 else Result := -1;
    end;

    function DNUSPL_ShowForm(const AForm: Integer; const APauseScript: Boolean): Boolean;
    begin
      Result := False;
      if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
      begin
        {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['DNUSPL_ShowForm', AForm])); {$endIf}
        DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
        Exit;
      end;

      if(APauseScript) then
        Result := DNUSPLForms[AForm].ShowModal = mrOk
      else begin
        DNUSPLForms[AForm].Show;
        Result := DNUSPLForms[AForm].Showing;
      end;
    end;

    function DNUSPL_AddControl(const AControlType, AForm: Integer; const ABounds: TFormRect;
      const AAdditionalParametres: TVariantArray; {$ifDef SPL_StringIdentifiers}
      const AParent, AIdentifier: TString{$else}const AParent: Integer{$endIf}):
      {$ifDef SPL_StringIdentifiers} Boolean{$else}) Integer{$endIf};
    var
      tmpControl: TControl;
      parentControl: TWinControl;
      tmpParentd{$ifDef SPL_StringIdentifiers}, tmpIdentd{$endIf} : TString;

      paramsLength, I: Word;
    begin
      {$ifDef SPL_StringIdentifiers} Result := False; {$else} Result := -1; {$endIf}
      if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
      begin
        {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['AddControl', AForm])); {$endIf}
        DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
        Exit;
      end;

      {$ifDef SPL_StringIdentifiers}
        tmpIdentd := SPL_Trim(AIdentifier);
        if(not(tmpIdentd = Lowercase(AIdentifier))) then
          {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['AddControl', AForm, AIdentifier, tmpIdentd])); {$else} Null; {$endIf}

        if(not(AParent = '')) then
        begin
          tmpParentd := SPL_Trim(AParent);
          if(not(tmpParentd = Lowercase(AParent))) then
            {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['AddControl', AForm, AParent, tmpParentd])); {$else} Null; {$endIf}
        end;
      {$else}
        if(not(AParent = 0)) then
          tmpParentd := IntToStr(AParent);
      {$endIf}

      paramsLength := Length(AAdditionalParametres);
      if(tmpParentd = '') then
        parentControl := DNUSPLForms[AForm]
      else begin
        parentControl := TWinControl(DNUSPLForms[AForm].FindComponent(DNUSPL_ComponentPrecede + tmpParentd));

        if(not(Assigned(parentControl))) then
        begin
          {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_InvalidParent, ['AddControl', AForm, tmpParentd])) {$endIf}
          Exit;
        end;
      end;

      case (AControlType) of
        {$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}:
        begin
          tmpControl := TPageControl.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := DNUSPLForms[AForm];
          if(Rect(0, 0, 0, 0) = ABounds) then
            tmpControl.Align := alClient
          else
            tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
        end;

        {$ifDef SPL_Prefix} SPL_COMP_Tab {$else} COMP_Tab {$endIf}:
        begin
          tmpControl := TTabSheet.Create(DNUSPLForms[AForm]);

          if(parentControl is TPageControl) then
            TTabSheet(tmpControl).PageControl := TPageControl(parentControl)
          else begin
            {$ifDef SPL_DisplayErrors}
              Writeln(Format(DNUSPL_Err_Str_InvalidTabControl, ['AddControl', AForm, tmpIdentd]));
            {$endIf}
            DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_InvalidTabControl {$else} ERR_InvalidTabControl {$endIf};
            Exit;
          end;

          if(paramsLength > 0) then
            tmpControl.Caption := AAdditionalParametres[0];
        end;

        {$ifDef SPL_Prefix} SPL_COMP_Button {$else} COMP_Button {$endIf}:
        begin
          tmpControl := TButton.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);

          if(paramsLength > 0) then
            tmpControl.Caption := AAdditionalParametres[0];
        end;

        {$ifDef SPL_Prefix} SPL_COMP_TextBox {$else} COMP_TextBox {$endIf}:
        begin
          tmpControl := TEdit.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
          TEdit(tmpControl).Text := '';
        end;

        {$ifDef SPL_Prefix} SPL_COMP_DropDown {$else} COMP_DropDown {$endIf}:
        begin
          tmpControl := TComboBox.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);
          TComboBox(tmpControl).Style := csDropDownList;

          if(paramsLength > 0) then
          begin
            for I := 0 to (paramsLength - 1) do
              TComboBox(tmpControl).Items.Add(AAdditionalParametres[I]);

            TComboBox(tmpControl).ItemIndex := 0;
          end;
        end;

        {$ifDef SPL_Prefix} SPL_COMP_Text {$else} COMP_Text {$endIf}:
        begin
          tmpControl := TLabel.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);

          if(paramsLength > 0) then
            tmpControl.Caption := AAdditionalParametres[0];
          if(paramsLength > 1) then
            TLabel(tmpControl).Font.Size := AAdditionalParametres[1];
          if(paramsLength > 2) then
            TLabel(tmpControl).Font.Color := AAdditionalParametres[2];
        end;

        {$ifDef SPL_Prefix} SPL_COMP_Picture {$else} COMP_Picture {$endIf}:
        begin
          tmpControl := TImage.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);

          if(paramsLength > 0) then
            TImage(tmpControl).Picture.Bitmap.Assign(GetMufasaBitmap(AAdditionalParametres[0]).ToTBitmap);
          if(paramsLength > 1) then
            TImage(tmpControl).Stretch := AAdditionalParametres[1];
          if(paramsLength > 2) then
          begin
            TImage(tmpControl).SetBounds(0, 0, DNUSPLForms[AForm].ClientWidth, DNUSPLForms[AForm].ClientHeight);
            tmpControl.SendToBack;
          end;
        end;

        {$ifDef SPL_Prefix} SPL_COMP_CheckBox {$else} COMP_CheckBox {$endIf}:
        begin
          tmpControl := TCheckBox.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);

          if(paramsLength > 0) then
            tmpControl.Caption := AAdditionalParametres[0];
          if(paramsLength > 1) then
            TCheckBox(tmpControl).Checked := AAdditionalParametres[1];
        end;

        {$ifDef SPL_Prefix} SPL_COMP_MemoBox {$else} COMP_MemoBox {$endIf}:
        begin
          tmpControl := TMemo.Create(DNUSPLForms[AForm]);
          tmpControl.Parent := parentControl;
          if(ABounds = Rect(0, 0, 0, 0)) then
            tmpControl.Align := alClient
          else
            tmpControl.SetBounds(ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height);

          if(paramsLength > 0) then
            for I := 0 to (paramsLength - 1) do
              TMemo(tmpControl).Lines.Add(AAdditionalParametres[I]);
        end;
      end;

      {$ifDef SPL_StringIdentifiers}
        tmpControl.Name := DNUSPL_ComponentPrecede + tmpIdentd;
        Result := Assigned(tmpControl);
      {$else}
        tmpControl.Name := DNUSPL_ComponentPrecede + IntToStr(DNUSPLComponentCount);
        if(Assigned(tmpControl)) then
          Result := DNUSPLComponentCount else Result := -1;
        Inc(DNUSPLComponentCount);
      {$endIf}
    end;

    {$ifDef SPL_Prefix}
      function SPL_DeleteComponent(const AForm: Integer; const {$ifDef SPL_StringIdentifiers} AIdentifier: TString {$else} AIdentifier: Integer {$endIf}): Boolean;
    {$else}
      function DeleteComponent(const AForm: Integer; const {$ifDef SPL_StringIdentifiers} AIdentifier: TString {$else} AIdentifier: Integer {$endIf}): Boolean;
    {$endIf}
    var
      tmpControl: TControl;
      tmpIdentd: TString;
    begin
      Result := False;
      if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
      begin
        {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['DeleteComponent', AForm])); {$endIf}
        DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
        Exit;
      end;

      {$ifDef SPL_StringIdentifiers}
        tmpIdentd := SPL_Trim(AIdentifier);
        if(not(tmpIdentd = Lowercase(AIdentifier))) then
          {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_ImplicitCast, ['DeleteComponent', AForm, AIdentifier, tmpIdentd])); {$else} Null; {$endIf}
      {$else}
        if(not(AIdentifier = 0)) then
          tmpIdentd := IntToStr(AIdentifier);
      {$endIf}

    //  tmpControl := TControl({$ifDef SPL_Prefix} SPL_FindComponent {$else} FindSPLComponent {$endIf}(
    //    TComponent(DNUSPLForms[AForm]), AIdentifier));
      tmpControl := TControl(DNUSPLForms[AFOrm].FindComponent(DNUSPL_ComponentPrecede + tmpIdentd));

      if(tmpControl is TTabSheet) then
        TTabSheet(tmpControl).PageControl.SelectNextPage(False, True);

      //tmpControl.Parent := nil;
      tmpControl.Free;

      Result := (not(Assigned(tmpControl)));
    end;

    function {$ifDef SPL_Prefix} SPL_CreateFormEx {$else} CreateFormEx {$endIf}(
      const ABounds: TFormRect; const ACaption: TString; const ABorderStyle: TBorderStyle): Integer;
    var
      Params: TVariantArray;
    begin
      Params := [ABounds.X, ABounds.Y, ABounds.Width, ABounds.Height, ACaption, ABorderStyle];
      ThreadSafeCall('DNUSPL_CreateForm', Params);
    end;

    function {$ifDef SPL_Prefix} SPL_ShowForm {$else} ShowForm {$endIf}(
      const AForm: Integer; const PauseScript: Boolean): Boolean;
    var
      Params: TVariantArray;
    begin
      Params := [AForm, PauseScript];
      Result := Boolean(ThreadSafeCall('DNUSPL_ShowForm', Params));
    end;

    function {$ifDef SPL_Prefix} SPL_AddTabSheetEx {$else} AddTabSheetEx {$endIf}
      (const AForm: Integer; const ABounds: TFormRect{$ifDef SPL_StringIdentifiers}; const ANewIdentifier: TString): Boolean {$else} ): Integer {$endIf};
    begin
      Result := DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}, AForm, ABounds, [], {$ifDef SPL_StringIdentifiers} '', ANewIdentifier {$else} 0 {$endIf});
    end;

    function {$ifDef SPL_Prefix} SPL_AddTabSheet {$else} AddTabSheet {$endIf}
      (const AForm: Integer{$ifDef SPL_StringIdentifiers}; const ANewIdentifier: TString): Boolean {$else} ): Integer {$endIf};
    begin
      Result := DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_TabSheet {$else} COMP_TabSheet {$endIf}, AForm, Rect(0, 0, 0, 0), [], {$ifDef SPL_StringIdentifiers} '', ANewIdentifier {$else} 0 {$endIf});
    end;

    function {$ifDef SPL_Prefix} SPL_AddTabsEx {$else} AddTabsEx {$endIf}(
      const AForm: Integer; {$ifDef SPL_StringIdentifiers} const AParent: TString;
      const AIdentifiers: array of TString; {$else} const AParent: Integer; {$endIf}
      const ACaptions: array of TString): {$ifDef SPL_StringIdentifiers} Boolean {$else} TIntegerArray {$endIf};
    var
      I, Count: Integer;
    begin
      Count := Length(ACaptions);
      if(Count > 0) then
      begin
        {$ifDef SPL_StringIdentifiers}
          if(not(Count = Length(AIdentifiers))) then
          begin
            {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_InvalidLength, ['AddTabsEx', AForm, 'AIdentifiers', 'ACaption'])); {$endIf}
            Exit;
          end;

          Result := False;
        {$else}
          SetLength(Result, Count);
        {$endIf}

        for I := 0 to (Count - 1) do
        begin
          {$ifNDef SPL_StringIdentifiers} Result[I] := {$endIf}
          DNUSPL_AddControl({$ifDef SPL_Prefix} SPL_COMP_Tab {$else} COMP_Tab {$endIf},
            AForm, Rect(0, 0, 0, 0), [ACaptions[I]], AParent {$ifDef SPL_StringIdentifiers}, AIdentifiers[I] {$endIf});
        end;
      end;
    end;

    function {$ifDef SPL_Prefix} SPL_AddTabs {$else} AddTabs {$endIf}
      (const AForm: Integer; {$ifDef SPL_StringIdentifiers} const AIdentifiers: array of TString;
      {$endIf} const ACaptions: array of TString): {$ifDef SPL_StringIdentifiers} Boolean {$else} TIntegerArray {$endIf};
    var
      I: Integer;
      tmpParentd: {$ifDef SPL_StringIdentifiers} TString {$else} Integer {$endIf};
    begin
      if(not(InRange(AForm, 0, (DNUSPLFormCount - 1))) or not(Assigned(DNUSPLForms[AForm]))) then
      begin
        {$ifDef SPL_DisplayErrors} Writeln(Format(DNUSPL_Err_Str_RangeCheck, ['AddTabs', AForm])); {$endIf}
        DNUSPLLastError := {$ifDef SPL_Prefix} SPL_ERR_RangeCheck {$else} ERR_RangeCheck {$endIf};
        Exit;
      end;

      for I := 0 to (DNUSPLForms[AForm].ComponentCount - 1) do
        if(DNUSPLForms[AForm].Components[I] is TPageControl) then
        begin
          tmpParentd := {$ifDef SPL_StringIdentifiers} Copy(DNUSPLForms[AForm].Components[I].Name, Length(DNUSPL_ComponentPrecede), Length(DNUSPLForms[AForm].Name)) {$else} I {$endIf};
          Exit;
        end;

      Writeln(tmpParentd);
      Result := {$ifDef SPL_Prefix} SPL_AddTabsEx {$else} AddTabsEx {$endIf}(AForm, {$ifDef SPL_StringIdentifiers} tmpParentd, AIdentifiers, {$else} tmpParentd, {$endIf} ACaptions);
    end;

    procedure {$ifDef SPL_Prefix} SPL_Setup {$else} SetupSPL {$endIf};
    {$ifDef SPL_CheckForUpdates}
      var
        pageVer: TString;
        tmpVer: Float;
    {$endIf}
    begin
      DNUSPLLastError:= -1;
      DNUSPLFormCount := 0;

      {$ifDef SPL_CheckForUpdates}
        pageVer := GetPage('http://****/srl/spl/latest_version.txt');
        writeln(pagever);
        tmpVer := StrToFloatDef(pageVer, -1.0);
        if(not(tmpVer = -1.0)) then
        begin
          if(tmpVer > DNUSPL_Version) then
          begin
            Writeln(' *** A new ' + DNUSPL_FullName + ' (' + FloatToStr(tmpVer) + ') has been released.');
            Writeln(' [' + DNUSPL_Acronym + '] Current Version: ' + FloatToStr(DNUSPL_Version) + '.');
            Writeln(' - It is highly recommended that you cease this script and download it immediately.');
            if(MessageDlg('[' + DNUSPL_Acronym + '] Update', 'A newer version of ' + DNUSPL_FullName +
              ' (' + FloatToStr(tmpVer) + ') is available for download. It is highly recommended that you ' +
              'stop this script and install this new update.' + CRLF + CRLF + 'Stop the script now?',
              mtConfirmation, [mbOK, mbCancel]) = mrOk) then
            begin
              Writeln(' [' + DNUSPL_Acronym + '] Good choice! Terminating script...');
              TerminateScript;
            end else
              Writeln(' [' + DNUSPL_Acronym + '] Continuing on then...');
          end else
            Writeln(' [' + DNUSPL_Acronym + '] You'#39're on the latest version.');
        end else
          Writeln(' [' + DNUSPL_Acronym + '] Unable to check for updates.');
      {$endIf}
    end;

    begin
      SPL_Setup;
      SPL_CreateFormEx(Rect(0, 0, 800, 600), 'Test', bsSingle);
      SPL_AddTabSheetEx(0, Rect(0, 0, 0, 0), 'test1 yeah');
      // Of course, the generic DNUSPL_AddControl will be simplified to AddTab, AddButton, AddCheckBox, etc.
      DNUSPL_AddControl(SPL_COMP_Tab, 0, Rect(0, 0, 50, 50), ['test page'], 'test1 yeah', 'w00t 231#');
      DNUSPL_AddControl(SPL_COMP_Tab, 0, Rect(0, 0, 0, 0), ['2'], 'test1 yeah', 'w11t23');
      DNUSPL_AddControl(SPL_COMP_Button, 0, Rect(50, 50, 75, 23), ['click me!'], 'w11t23', 'thisbutton');
      SPL_ShowForm(0, True);
    end.

    Take anything from that if you like. Who knows? I may continue it some day.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

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

    Default

    That is wicked, @Daniel;, thanks! I was going to look into tabs and such soon, so you just saved me a lot of trouble - as I see your example uses them!

    Edit: TBorderStyle can not be used in Lape, but so far it's going along smoothly. Thanks again!
    Last edited by Obscurity; 11-06-2015 at 09:16 PM.




    Skype: obscuritySRL@outlook.com

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

    Default

    :: Automated Message ::
    Added Tab Elements, Parent Method, Etc


    ObscuritySRL updated on Saturday, November 07, 2015

    183 additions, 40 deletions.

    Fixed automatic sizing issues.

    Added the tab and tabList elements.

    Added the eZForm.addTab() method. If an ID is passed, for example iTabs,
    the tabs created will be given the IDs iTabs0, iTabs1, iTabs2, etc. An
    example has been added to the initial post of the eZForm thread.

    Added the select property and methods to tabList elements. These will
    return or set the selected tab in a tabList.

    Added the parent property and methods to all elements. These will return
    or set the parent of an element. An example has been added to the
    initial post of the eZForm thread.
    A total of 1 files were affected:








    Thanks to @Daniel; for his help with tabs!

  19. #44
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Woop woop! Good stuff good stuff... I'm glad this is progressing so much as of late! What more can you do? A+ work.

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

    Default

    :: Automated Message ::
    Bug Fixes, Auto-Sizing Images, Etc


    ObscuritySRL updated on Wednesday, November 11, 2015

    22 additions, 4 deletions.

    Images now automatically size themselves if the dimensions parameter is
    set to [0,0] when using eZForm.addImage().

    Changing the visible properties of multiple elements will now work as
    expected. Previously, hiding or showing more then a single element in
    one thread would seemingly ignore the rest.

    eZForm.show() is now a function and will return the current form. This
    is useful for setting a custom dimensions and changing properties on the
    fly, for example:
    eZForm.show().height(240);
    A total of 1 files were affected:





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

    Default

    :: Automated Message ::
    Added Remove Methods, Bug Fixes, Other Methods


    ObscuritySRL updated on Tuesday, November 17, 2015

    136 additions, 47 deletions.

    Fixed bugs for image and tab elements.

    Fixed eZForm.find() methods to function correctly. This issue was making
    methods such as eZElement.parent() fail to execute properly.

    Re-added eZForm.remove() methods. Previously, adding or removing an
    element from a form after the form had been shown would cause Simba to
    crash.

    Added the eZElement.append() method. This method will append a string to
    the end of any control, add an item to a combobox or listbox, etc.

    Added the eZElement.empty() methods. These can be used to completely
    empty the contents of a combobox or listbox. Alternatively, an index may
    be specified.

    Removed the optional multiple property from listboxes.

    Added the multiple property to tabs. With this enabled, if a list of
    tabs is too wide, they will span multiple lines.

    Changed the return types of various methods. For example, listbox.val()
    previously returned the selected text. It now returns the selected
    index. listbox.text() now returns the selected text.

    Added the eZElement.selections() methods. These return a full list of
    possible string selections of an element. For example,
    combobox.selections(). Alternatively, if passed a stringArray, it will
    change the possible selections.
    A total of 1 files were affected:





  22. #47
    Join Date
    Dec 2014
    Posts
    188
    Mentioned
    3 Post(s)
    Quoted
    100 Post(s)

    Default

    Cannot download eZForm.simba since it opens the source code page (or is it supposed to copy it to a simba file?)

  23. #48
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    203
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by srpronto View Post
    Cannot download eZForm.simba since it opens the source code page (or is it supposed to copy it to a simba file?)
    Right click the link and choose 'Save link as...', the popup will automatically give it the .simba extension and you can save it wherever

  24. #49
    Join Date
    Dec 2014
    Posts
    188
    Mentioned
    3 Post(s)
    Quoted
    100 Post(s)

    Default

    Thanks

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

    Default

    :: Automated Message ::
    Fix For ProSocks v0.5, Added Edit and Memo Methods


    ObscuritySRL updated on Saturday, December 05, 2015

    89 additions, 55 deletions.

    Added eZElement.copy(), eZElement.cut(), eZElement.paste(), and
    eZElement.selectAll() methods for Edit and Memo elements.

    Added the eZElement.selections() method for TabList elements.

    Fixed tPicture.loadFromURL() to correctly use ProSocks v0.5.
    A total of 1 files were affected:





Page 2 of 3 FirstFirst 123 LastLast

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
  •