Frage

I am using Lua 5.1.4 and IUP 3.4.0.

Given the code:

dlg =  iup.dialog {
    iup.hbox {
        iup.tabs {
            tab1,
            tab2
        }
    }
    ;
    title = "window",
    rasterSize = "640x480"
}

where tab1 and tab2 are each an iup.hbox containing one or more elements, how can I make the iup.tabs element take up the entire window?

War es hilfreich?

Lösung

Your solution is not totally a hack. Actually is pointing in the right direction. The iup.fill{} element can be used to do that, it is a void element that does exactly that. But since it expands only in the direction of the box, a solution will look like this:

tab1 = iup.hbox {
    iup.button { title = "A button" },
    iup.fill { },
    iup.vbox{iup.fill { }}
    ;
    tabtitle = "Tab1"
}

Andere Tipps

After some experimentation, the solution that worked for me was to insert an invisible label element into one of the tabs, working example below.

require( "iuplua" )

tab1 = iup.hbox {
    iup.button { title = "A button" },
    iup.label { expand = "yes" }
    ;
    tabtitle = "Tab1"
}

tab2 = iup.hbox {
    iup.button { title = "Another button" }
    ;
    tabtitle = "Tab2"
}

dlg =  iup.dialog {
    iup.hbox {
        iup.tabs {
            tab1,
            tab2
        }
    }
    ;
    title = "window",
    rasterSize = "640x480"
}

dlg:showxy( iup.CENTER, iup.CENTER )
iup.MainLoop()

This feels like a hack to me, I'm sure a cleaner way exists.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top