@@ -24,9 +24,9 @@ local basalt = require("basalt") -- we need basalt here
2424local main = basalt .createFrame ():setTheme ({FrameBG = colors .lightGray , FrameFG = colors .black }) -- we change the default bg and fg color for frames
2525
2626local sub = { -- here we create a table where we gonna add some frames
27- main :addFrame ():setPosition (1 , 2 ):setSize (" parent.w" , " parent.h - 1" ), -- obviously the first one should be shown on program start
28- main :addFrame ():setPosition (1 , 2 ):setSize (" parent.w" , " parent.h - 1" ):hide (),
29- main :addFrame ():setPosition (1 , 2 ):setSize (" parent.w" , " parent.h - 1" ):hide (),
27+ main :addFrame ():setPosition (1 , 2 ):setSize (" { parent.w} " , " { parent.h - 1} " ), -- obviously the first one should be shown on program start
28+ main :addFrame ():setPosition (1 , 2 ):setSize (" { parent.w} " , " { parent.h - 1} " ):hide (),
29+ main :addFrame ():setPosition (1 , 2 ):setSize (" { parent.w} " , " { parent.h - 1} " ):hide (),
3030}
3131
3232local function openSubFrame (id ) -- we create a function which switches the frame for us
@@ -39,7 +39,7 @@ local function openSubFrame(id) -- we create a function which switches the frame
3939end
4040
4141local menubar = main :addMenubar ():setScrollable () -- we create a menubar in our main frame.
42- :setSize (" parent.w" )
42+ :setSize (" { parent.w} " )
4343 :onChange (function (self , val )
4444 openSubFrame (self :getItemIndex ()) -- here we open the sub frame based on the table index
4545 end )
@@ -71,15 +71,14 @@ This example illustrates how to create a sidebar with buttons that can be used t
7171<details >
7272<summary >Click here to show code</summary >
7373
74-
7574``` lua
7675local basalt = require (" basalt" ) -- we need basalt here
7776
7877local main = basalt .createFrame ():setTheme ({FrameBG = colors .lightGray , FrameFG = colors .black })
7978
8079--[[
8180Here we create the sidebar, on focus it should change the position to parent.w - (self.w-1) which "opens the frame"
82- when the focus gets lost we simply change the position to "parent.w"
81+ when the focus gets lost we simply change the position to "{ parent.w} "
8382As you can see we add :setZIndex(25) - this makes sure the sidebar frame is always more important than our normal sub frames.
8483:setScrollable just makes the sidebar frame scrollable (in case you're adding more frames)
8584]]
0 commit comments