View Single Post
Old 11-14-2018, 01:05 PM   #355
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 1,025
Default

Quote:
Originally Posted by Lokasenna View Post
You might find it easier to just have multiple rows and move the values up to the next row.
Yes I think I will look at moving the values, It would save having a lot of textboxes, and there would be a limit I'd imagine.


I can't see how to get a value in a textbox without typing or pasting.
The textboxes in GetUserInputs can preset values:

local defaults = {"Def 1", "Def 2", "Def 3", "Def 4", "Def 5", "Def 6"}


The only way I found so far is edit Class - Textbox.lua

Code:
txt_default = ""

GUI.Textbox = GUI.Element:new()
function GUI.Textbox:new(name, z, x, y, w, h, caption, pad)

    local txt = (not x and type(z) == "table") and z or {}

    txt.name = name
    txt.type = "Textbox"

    txt.z = txt.z or z

    txt.x = txt.x or x
    txt.y = txt.y or y
    txt.w = txt.w or w
    txt.h = txt.h or h

    txt.retval = txt.retval or txt_default
and in the GUI script:
Code:
local function scroll_up()

     y1=y1+50

     txt_default = GUI.Val("my_text1") or ""
     GUI.New("my_text1", "Textbox", {
        z = 1,
        x = 10,
        y = y1,
        w = 100,
        h = 35,
        caption = "",
        cap_pos = "left",
        font_a = 3,
        font_b = {"Chords", 28}, 
        color = "white",
        bg = "wnd_bg",
        shadow = true,
        pad = 4,
        undo_limit = 20,
       
        
    })
    
     txt_default = GUI.Val("my_text2") or ""
     GUI.New("my_text2", "Textbox", {
        z = 1,
        x = 120,
        y = y1,
        w = 100,
        h = 35,
        caption = "",
        cap_pos = "left",
        font_a = 3,
        font_b = {"Chords", 28}, 
        color = "white",
        bg = "wnd_bg",
        shadow = true,
        pad = 4,
        undo_limit = 20,
       
        
    })
     
   
    
end

local function scroll_down()

     y1=y1-50

     txt_default = GUI.Val("my_text1") or ""
     GUI.New("my_text1", "Textbox", {
            z = 1,
            x = 10,
            y = y1,
            w = 100,
            h = 35,
            caption = "",
            cap_pos = "left",
            font_a = 3,
            font_b = {"Chords", 28},
            color = "white",
            bg = "wnd_bg",
            shadow = true,
            pad = 4,
            undo_limit = 20
            
        })
        
     txt_default = GUI.Val("my_text2") or ""
     GUI.New("my_text2", "Textbox", {
            z = 1,
            x = 120,
            y = y1,
            w = 100,
            h = 35,
            caption = "",
            cap_pos = "left",
            font_a = 3,
            font_b = {"Chords", 28},
            color = "white",
            bg = "wnd_bg",
            shadow = true,
            pad = 4,
            undo_limit = 20
            
        })    
        
    
end
MusoBob is offline   Reply With Quote