• DIconLayout not 'refreshing'
    3 replies, posted
Hey Facepunch, been a while since I didn't posted, So here's my problem, I'm trying to do a DIconLayout that changes it's children (SpawnIcons) depending on the value of a DComboBox What I did for now is this : Homme = {   'models/player/group01/male_01.mdl',   'models/player/group01/male_02.mdl',   'models/player/group01/male_03.mdl',   'models/player/group01/male_04.mdl',   'models/player/group01/male_05.mdl',   'models/player/group01/male_06.mdl',   'models/player/group01/male_07.mdl',   'models/player/group01/male_08.mdl',   'models/player/group01/male_09.mdl' }     local base_sex = vgui.Create("DComboBox", base)     base_sex:SetSize( 100, 20 )     base_sex:SetValue( "Sexe" )     base_sex:AddChoice( "Homme" )     base_sex:SetSize( ScrW() / 10, 30 )     local size_x, size_y = base_sex:GetSize()     base_sex:SetPos( ScrW() / 8 - size_x / 2, 150)     base_sex.OnSelect = function( self, index, value )     generateModels()     end     local model_frame = vgui.Create('DScrollPanel', base)     model_frame:SetSize( ScrW() / 4 - 50, ScrH() / 2 - 230)     model_frame:SetPos( 25, 205)     model_frame.Paint = function(s, w, h)       draw.RoundedBox(0, 0, 0, w, h, Color(15, 15, 15, 225))     end     local model_list = vgui.Create( "DIconLayout", model_frame )     model_list:Dock( FILL )     model_list:DockMargin( 20, 20, 20, 0)     model_list:SetSpaceY( 20 )     model_list:SetSpaceX( 20 )     function generateModels()       for k, v in pairs(Homme) do         local model_icon = vgui.Create( "SpawnIcon" , model_list )         model_icon:SetModel( v )       end     end I checked, the function generateModels is called (I used a print that showed up) Now the problem is that nothing appears on the DIconLayout, whereas it works if I remove the function and generate the SpawnIcons in the same time than the DIconLayout. I've tested with others VGUI elements such as DPanel and the same things happens. Thank you for your help, Benji
Please refer to the example here: https://wiki.garrysmod.com/page/Category:DIconLayout Also you never clear your DListLayout
I've alreay seen and used this example. And about clearing the DListLayout, I'm first trying to fill it xD Then I'll clear it everytime you click the DComboCox
Does anyone has the answer ?
Sorry, you need to Log In to post a reply to this thread.