• New DNumSlider
    5 replies, posted
Hello guys, I'm in a little trouble now, I'm quite new to Gmod 13 and I found out that DNumSlider has "improved" a little but is there any way to disable this new function or what should I call this : [URL=http://imageshack.us/photo/my-images/248/2rs.png/][IMG]http://imageshack.us/scaled/thumb/248/2rs.png[/IMG][/URL]
I found this in the code of vgui/DNumSlider.lua: [LUA] self.Scratch = self.Label:Add( "DNumberScratch" ) self.Scratch:SetImageVisible( false ) self.Scratch:Dock( FILL ) self.Scratch.OnValueChanged = function() self:ValueChanged( self.Scratch:GetFloatValue() ) end [/LUA] So you could probably remove that feature by doing numslider.Scratch:Remove() right after you make it. EDIT: That might cause errors, though. You could alternatively do function numslider.Label:OnMousePressed(mc) return end to prevent it from opening. Maybe. Tell me if it works out.
Well it really removed this new window but i have this problem : [URL=http://imageshack.us/photo/my-images/202/1rs.png/][IMG]http://img202.imageshack.us/img202/9657/1rs.png[/IMG][/URL] The bar is too small :s
Oh. panel:SetWide(width) will make it bigger.
From my debug code: [lua] self.pAngIndex = index; self:AddSlider( index, self, offset, "Angle P", -250, 250, function( val ) if ( !DEBUG_HOLSTERED_WEAPONS_TABLE ) then return; end; self.SelectedHS.ang.p = val; end ); offset = offset + self._sheetList[ index ]:GetTall( ) + 5; index = index + 1;[/lua] [lua]function PANEL:AddSlider( k, parent, offset, title, min, max, onValueChangedCallback ) self._sheetList[ k ] = vgui.Create( "DNumSlider", parent ); self._sheetList[ k ]:SetText( title ) self._sheetList[ k ]:SetMin( min ) self._sheetList[ k ]:SetMax( max ) self._sheetList[ k ]:SetDecimals( 2 ) self._sheetList[ k ].Scratch:SetZoom( 25 ) self._sheetList[ k ]:SetValue( 0 ) self._sheetList[ k ].Label:SetWide( parent:GetWide( ) / 6 ) -- self._sheetList[ k ].Label:SetMouseInputEnabled( false ) self._sheetList[ k ]:SetDark( true ) self._sheetList[ k ]:SetWide( ( parent:GetWide( ) ) - 15 ) self._sheetList[ k ]:SetPos( 15, offset ); self._sheetList[ k ].OnValueChanged = function ( val ) onValueChangedCallback( tonumber( self._sheetList[ k ].TextArea:GetValue( ) ) ) end return end[/lua] To disable that feature, uncomment: -- self._sheetList[ k ].Label:SetMouseInputEnabled( false ) To adjust the width, look at the SetWide code. You need to reduce the label width, and increase the panel width.
Ah thanks, it worked with a little modification
Sorry, you need to Log In to post a reply to this thread.