Soda v0.7: gorgeous and powerful GUI/ windowing/ button library. Now with fully selectable text.



  • Posts: 1,285

    I know this is way laggy on my end, but I just went in GitHub and made some proposed changes to the readme, to be a little more explicit about the overloaded coordinate system, and about the care needed to be sure that integers and floats are only used for their intended purposes that system.

  • Posts: 1,285

    Oh also, suggestion @yojimbo2000 : the first tab calls itself a template but it isn't immediately obvious what part creates the demo.

    In other words, to actually use it as a template, I have to be able to easily paste it into a new project and then easily remove the parts that start the demo. Right now every time I paste it into a new project I go through the same confusion, saying to myself "now, how the heck did I get rid of the demo last time?"

  • Is their any tutorial for this? I'm having troubles :/

  • Posts: 2,020

    @Beekeeper928 tutorial is here:


    I don't see the changes you mentioned making to the readme, if they're are on your own fork, you need to make a pull request back to my repo (you should see a big "create a pull request" button on your fork)

  • Posts: 1,285

    @Beekeeper928, you might want to check out SodaSpec, available here:

    Two of the things that threw me about Soda were that I had to learn its parameter names before using it, and that I had to search through the code to find out the names for the different kinds of UI elements.

    SodsSpec addresses both issues.

    It lets you create almost every element without setting any parameters beforehand.

    And the setup() function in the demo project is basically a list of every single element it can make.

    Plus, it creates boba-fide Soda objects, so once you know Soda better you can access that entire functionality as well.

  • edited October 2017 Posts: 122

    minor bug report: create two lists with same parent, width, height, only one draws/senses correct despite different text

    So I made a thread with this question but got no meaningful answer. Where do list items get their text from? I want to make two lists, where selecting an item in list1 triggers a callback to list 2 to change what it displays

    List1 = {'one', 'two', 'three'}
    List2 = {{'cat', dog'}, {'mouse', 'elephant', 'barrier'}, {'Squid',' Log',' Dinosaur'}}

    Select --> Display cat, dog
    Select List1.two --> Display mouse, elephant, barrier
    Select List1.three --> Display Squid, Log, Dinosaur

  • edited July 2018 Posts: 7

    The following code uses Soda, and returns an error
    Soda: 37: attempt to perform arithmetic ona nil value (field ‘UIoffset’)
    Stack trace back:
    Soda:37: in field camera
    Main:62: in function ‘draw’
    Can you assist please

    -- Template for projects using Soda
    assert(SodaIsInstalled, "Set Soda as a dependency of this project") --produces an error if Soda not a dependency
    function setupUI()
        --Lets add a dropdown list to our accountPanel
    local panel = Soda.Window{ 
        title = "Sapphire Pricing", 
        x=0.5, y=-0.001, w=0.7, h=0.51, 
        blurred = true, shadow = true, 
    --account panel
    local accountPanel = Soda.Frame{
        parent = panel,
        x = 10, y = 10, w = -10, h = -60, 
        shape = Soda.RoundedRectangle, subStyle = {"translucent"},
        shapeArgs = {radius = 16} 
    --and, our dropdown list:
        parent = accountPanel,
        --we want it to tuck in below the text entry box, with a 10 pixel gap
        --so, y = -60 (the top of the textbox) -40 (height of text box) -10(gap between boxes) = -110
        x = 10, y = -110, w = -10, h=40, 
        title = "Sapphire Colour",
        --we pass "text" an array of strings for each item in the list
        text = {"Blue","bluish Green","bluish Purple","Red","bluish Violet","orange Yellow","Pink",
        "Clear","green Blue or blue Green","Orange","orange Red","greenish Yellow","Brown"
        ,"Purple","Green","reddish Orange","Red orange or Orange red","reddish purple",
        "red Purple or purple Red","slightly purplish Red","strongly purplish Red",
        "strongly yellowish Green","Violet","violetish Blue","very slightly bluish Green",
        "very slightly greenish Blue","very strongly bluish Green",
        "very strongly greenish Blue","Yellow","yellowish Green","yellow Green or green Yellow",
        "yellowish Orange"},       
        --list callbacks return 3 values: self, the selected item, and the label text of the selected item
        callback = function(self, selected, txt)
                title = txt.." are not\nthe only Colours"
    function draw()
    --do your updating here
    --end of updating
    pushMatrix() --this scrolls the screen to stop the keyboard covering textEntry fields
    function drawing(breakPoint) --the breakPoint variable stops a blurred window itself from being incorporated into the blurred effect: it ensure only things under the blurred area get drawn.
    --in order for gaussian blur to work, do all your drawing here
    background(40, 40, 50)
    sprite("Cargo Bot:Game Area", WIDTH*0.5, HEIGHT*0.5, WIDTH, HEIGHT)   
    text("Output\narea", WIDTH * 0.5, HEIGHT * 0.75)
    --end of your drawing
    Soda.draw(breakPoint) --pass the breakPoint variable
    --user inputs:
    function touched(touch)
    function keyboard(key)
    function orientationChanged(ori)
    --template ends
    function setupUI()
    y = 0.75, w = 0.4, h = 0.4,
    title = "Main",
    content = 
    [[This can be used as a template
    for the Main tab in your own
    projects running Soda. It contains
    all the hooks that you need to
    connect Soda into the setup, draw,
    touched, keyboard, and 
    orientationChanged routines.
  • Posts: 645

    @colincooper your first function should be called setup() not setupUI()

  • Thanks for that

  • @yojimbo2000 is there a way that changing a slidervalue executes a callback while the value is being changed, rather than only when the finger is lifted off the slider (in the same way as the inbuilt codea parameter slider).

  • edited April 2019 Posts: 1

    Hi All... Completely new to Codea

    When I install Soda the demo works fine, installs all the tabs, no issue.

    If I run the file again I get this, what am I doing wrong:

    UPDATE: Ok, so I’ve had some success getting this to run by changing the order of the tabs, but I’m still getting error messages and screens overdrawn. Is there a set sequence of tabs or am I still barking up the wrong tree?

  • Hi @TonyNE!
    Welcome to the Codea community!

    Yes, there is a sequence of tabs because require was not used (it is very common in codea projects).

    The order for the Soda v0.7 is: Main, Demo, Overview, Soda, Gesture, Style, RoundRect, Blur, FRAME, Button, Toggle, Switch, TextEntry, Slider, Selector, Segment, Scroll, ScrollShape, TextScroll, List, Windows.

    But how did you install it? From my old memories, the tabs was in good order when I installed it a long time ago x)

  • Posts: 1

    I've been attempting to get started with Soda and having a bit of bad luck. The installer script would work and it would open the demo and the demo functioned but, then when I closed the demo and went back to the code editor, none of the tabs were present. I had to rerun the installer script in order to get the demo working again. It was only like on the 3rd or 4th attempt that the tabs were actually created and then even though the demo had been running, when I went back to the code editor, trying to start the demo again would fail to run until I moved the tabs into the order outlined in the previous post.

    Also, the SodaTutorial runs now that Soda has the tabs and they are in the correct order but, the tutorial just shows "Output area" in the top / middle of the screen and there's a dropdown that says "Tutorial Step: 1" and tapping on it does nothing and there's nothing to select. I'd love to be able to run the tutorial. Any ideas on why it's broken and what can be done to fix it?

    I'm running Codea 3.2.2 (225) on a 10.5" iPad Pro running iPadOS 13.4.1

  • Hello, tetsuo29.

    Is Soda still working for you? I can’t get it to work either. It installed fine but the tabs were in alphabetical order, and I also rearranged them per the instructions from the prior poster. I can run Soda and get the basic into screen to show up, but when I link Soda as a dependency to either the Soda tutorial or my own app, I get this error right away:

    Dependency Error
    There was an error in project “Soda”
    At Blur:1 attempt to index a nil value
    (Global ‘Soda’)

    I’m running Codea 3.2.8 (244) on original iPad Pro running iPadOS 14.2


  • Sorry to have bothered everyone. Although I couldn’t get the tutorial to work, with trial and error, I did figure out how to use Soda and link it as a dependency to my scripts. Thanks.

Sign In or Register to comment.