Page 1 of 19 12311 ... LastLast
Results 1 to 10 of 188

Thread: Learning Oxygen and discussion of ideas for projects

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

    Learning Oxygen and discussion of ideas for projects

    I guess this should be moved out from User Tools Eros now and in some other suitable category as you see fit.

    Original Post:I thought I would start a new topic for the development of thinForm Version 2.

    I am going to use O2H to make classes for the various form control objects.
    http://community.thinbasic.com/index.php?board=175.0

    I am thinking of making each class a separate txt file that can be combined into a final source file to be compiled. This way the classes could be easily used in other projects when needed.


    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

  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: thinForm v2 development

    Charles, I am going to follow your convention of prefixing class files as:

    class_controlname.txt

    Should we use something other than txt for the file extension? The reason, I am thinking that perhaps you could add a new command to O2H that will load all class files into a single source file or
    @Eros this could be a new thinBasic command.

    Something like: LoadClasses ( class folder path ) this would return a single combined text file.
    Then the programmer could add additional code and then terminate the source file for compiling as usual.
    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 MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    test script 1 for classes and methods

    Charles, here is a test script that is not working, when you have a chance can you look it over and help me see the light thanks.

    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

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

    Re: thinForm v2 development

    Kent,

    maybe better to send a PM to Charles about your idea. Maybe he miss this post.

    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

  5. #5

    Re: thinForm v2 development


    Hi Kent,

    Here's one way to do it.

    NB: one complication of creating a union inside the class: the hidden virtual table pointer!

    [code=thinbasic]

    Uses "Oxygen"

    dim src as string

    src="




    Uses "Oxygen"

    dim src as string

    src="

    class color_rgba
    method get() as long
    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    /
    r as byte
    g as byte
    b as byte
    a as byte
    =
    pvt as long ' hidden virtual table pointer
    rgba as long
    end class

    methods of color_rgba

    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    with this.
    r = r
    g = g
    b = b
    a = a
    end with
    end method

    method get() as long
    method=this.rgba
    end method

    end methods

    dim c as color_rgba
    c.set(125,50,0,12

    print hex c.get()


    terminate

    "




    o2_basic src

    if len(o2_error) then
    msgbox 0,o2_error
    stop
    end if

    o2_exec

    [/code]

  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: thinForm v2 development

    Charles thanks for the correction, but I am lost in some areas.

    1. I don't understand why pvt is a member variable and I don't see it used elsewhere?

    2. Also, why do we use hex in the print statement for a long value-- when I take hex out, the app doesn't print?

    3. I am also not sure what the = in the class declaration does?

    Another request is if you can just give me a list of available keywords for oxygen it would give me an idea of what is there to play with for testing and learning.

    Looking at the corrected code, I really like the syntax and layout you came up with. It is just so much fun to play with objects thanks for giving us this capability!

    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

    test1 next step

    Charles, I am playing with method overloading and it is fun!

    Anyways I did this test and I thought I should get the same value back, but I am not. Not sure why? Sorry to keep bugging you, but the only way to learn is to try, try, try and then ask for help

    [code=thinbasic]Uses "Oxygen"

    dim src as string

    src="

    class color_rgba
    method get() as long
    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    method set(byval rgba as long )
    /
    r as byte
    g as byte
    b as byte
    a as byte
    =
    pvt as long ' hidden virtual table pointer
    rgba as long
    end class

    methods of color_rgba

    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    with this.
    r = r
    g = g
    b = b
    a = a
    end with
    end method

    method set(byval rgba as long )
    this.rgba = rgba
    end method

    method get() as long
    method=this.rgba
    end method

    end methods

    dim c as color_rgba
    c.set(255,255,255,255)

    print hex c.get()

    c.set(hex c.get()) 'Which would we use? Both return values, but they don't match the first c.get.
    'c.set(c.get())

    print hex c.get()


    terminate

    "




    o2_basic src

    if len(o2_error) then
    msgbox 0,o2_error
    stop
    end if

    o2_exec

    [/code]
    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

    Re: thinForm v2 development

    Quote Originally Posted by kent sarikaya

    Another request is if you can just give me a list of available keywords for oxygen it would give me an idea of what is there to play with for testing and learning.
    Have a look here: http://community.thinbasic.com/index.php?topic=2541.0

  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: thinForm v2 development

    Thanks Mike for the link!
    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

    Re: thinForm v2 development



    Hi Kent,

    Yes there was a bug affecting functions being used as operands. Many thanks for exposing it! I've posted the repaired Oxygen.

    http://community.thinbasic.com/index.php?topic=2517

    The only error I found in your code was passing a string argument:

    c.set (hex c.get())
    c.set(c.get())

    With Basic there is automatic type conversion, so the rules start to get a little complicated when function overloading is added. If Oxygen cannot convert the parameters to the required type then it goes in search of next method/function bearing the same name and tries that.


    [code=thinbasic]


    Uses "Oxygen"

    dim src as string

    src="
    class color_rgba
    method get() as long
    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    method set(byval rgba as long )
    /
    r as byte
    g as byte
    b as byte
    a as byte
    =
    pvt as long ' hidden virtual table pointer
    rgba as long
    end class

    methods of color_rgba

    method set(byval r as byte, byval g as byte, byval b as byte, byval a as byte )
    with this.
    r = r
    g = g
    b = b
    a = a
    end with
    end method

    method set(byval rgba as long )
    this.rgba = rgba
    end method

    method get() as long
    method=this.rgba
    end method

    end methods

    dim c as color_rgba

    c.set(1,2,3,4) : print hex c.get
    c.set(0x04030201) : print hex c.get
    c.set(c.get) : print hex c.get ' did not work correctly
    c.set(c.get+0) : print hex c.get


    terminate

    "
    o2_basic src

    if len(o2_error) then
    msgbox 0,o2_error
    stop
    end if

    o2_exec

    [/code]

Page 1 of 19 12311 ... LastLast

Similar Threads

  1. Asimo's Learning Capabilities
    By Charles Pegge in forum Shout Box Area
    Replies: 12
    Last Post: 28-04-2010, 18:22

Members who have read this thread: 2

Posting Permissions

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