Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Delphi code examples

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,778
    Rep Power
    10

    Delphi code examples

    Do you have some Turbo Delphi code you would like to test as thinBasic module?
    Please send me via personal message or post here and I will se if I can use it as testing code.
    Just simple or medium examples at first.

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Delphi code examples

    Eros, I can write something. Do you want the turbo delphi code, or compiled dll? What sort of program would you like?
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,778
    Rep Power
    10

    Re: Delphi code examples

    I need simple or complex source code Delphi functions to be developed as thinBasic Module.

    So source code functions to be included in the Delphi experiment I'm doing and that I will redistribute as sources example for using Delphi for developing thinBasic modules.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Delphi code examples

    Hmmm, I tried to make a dll that when you called a function it was to launch a form, but it crashed although I got no errors in making the dll in Delphi. It was not anything useful just a test.

    But if I understand correctly, you need a dll compiled in turbo delphi that adds some functions in thinBasic, sort of like Petr's examples in the delphi SDK.

    I will work on something with a draw so maybe we can draw easier in thinbasic. Not sure how it will go, will try
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,778
    Rep Power
    10

    Re: Delphi code examples

    No, Kryton9, I do not need anything compiled I just need some source code to test.
    You cannot test yourself because I've not yet distributed new thinCore.dll than contains new features needed to interface with dll created using Delphi.

    For example imagine you have a piece of sopurce code in Delphi that returns the reverse of a string. Send me and I will try to develop as thinBasic keyword but using Delphi as development environment.

    An example I'm testing:
    [code=delphi] //----------------------------------------------------------------------------
    // Returns the reverse of a specified string
    // Syntax: s = Reverse(AnyStringExpression)
    //----------------------------------------------------------------------------
    function Exec_Reverse() : pChar; stdcall;
    var MyString: String;

    begin
    thinBasic_CheckOpenParens;
    thinBasic_ParseString_Delphi(MyString);
    thinBasic_CheckCloseParens;

    MyString := ReverseString(MyString);
    Exec_Reverse := pChar(MyString);

    end;[/code]

    You will not be able to compile this code bacause I've not already distributed thinCore.dll with thinBasic_ParseString_Delphi" function interface able to pass dynamic strings from thinBasic to Delphy.

    At the moment keywords returning string developed under Delphi are still limited to return a pointer to a NULL terminated buffer but I'm working on that.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Delphi code examples

    Ok, wow am very please to get this figured out with the fine help offered here and to give back a neat simple example.
    This dll example shows how you can use the Turbo Delphi IDE to design your form and then use it in your thinBasic program.

    I will work on a more elaborate form example next, but this is to show how cool all of this is working with Turbo Delphi and ThinBasic.
    Thanks for the great start by Petr and then Eros on all of this coding and examples!!

    Attached Files Attached Files
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  7. #7
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Delphi code examples

    Ok this one is neat in that the 3 controls are interconnected. That is change a value in one control and it reflects in the other 2 right away. The 3 controls are a trackbar, editbox and up/down spinner.

    My problem and what I need with is figuring out how to get the value from the editbox back to thinbasic? Haven't gotten that far yet.
    But am happy that a relatively control setup can be done so easilly in Delphi and used in thinBasic.

    edited removed the nonwell working version and placed a better version below, this returns the value back fine to thinBasic.

    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,778
    Rep Power
    10

    Re: Delphi code examples

    See if this can help.
    Functions returning a number should be defined as returning extended data type.

    When using forms, they must be shown with .Show method. ShowModal will show the form but will keep the control till the form is closed. So if you want get back some info, you will not be able because controlling process never exit from the form. Using .Show, Delphi shows the form and process control immediately go further. In this way we can make a loop in thinBasic script checking some values or doing some other work like interfacing with TBGL or other stuff.

    Of course we need to implement "Form_Control_GetValue" keyword to be more clever. Maybe passing a string indicating what control to return the value.

    It is just a possible starting.
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Delphi code examples

    Eros I took a nap and solved the problem before coming to check here. I thought you would have been asleep. Anyways I will download and look at your upload.

    I figured out how to use a global variable from unit to unit, well actually found a place to read about it online. Anyways, got it working.
    Back to sleep now, I will look at yours tomorrow when I am back home.

    This is fun!!

    I will delete the previous bad one to not waste space on the server here. This is the latest one with the 3 controls working together.
    Attached Files Attached Files
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,778
    Rep Power
    10

    Re: Delphi code examples

    Hi kryton9 (somewhere in future I will get you first name :P ),

    I checked you example but again the problem is that you are showing the form as modal so no way to interact with it until it get closed.
    The trick is to define you form as global variable in Delphi, showing it as modeless. In this way the form is shown and process control pass immediately to the script engine.
    At this point make a lopp until ... something so you can interact with your forms using some new keyword you have to develop in your module.

    In any case, ther can be many different ways. It all depends by your need. Usually module are something general so best to be general and develop as many keyword functions are needed to interact with the form.

    Up to you and have nice ... programming.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 2 12 LastLast

Similar Threads

  1. Delphi resources
    By Michael Hartlef in forum Turbo Delphi language SDK development
    Replies: 4
    Last Post: 16-12-2006, 21:45

Members who have read this thread: 5

Posting Permissions

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