Hi,
I'm creating my first Derma Panel right now, and I have some problems.
My first problem: I tried to create CheckBoxLabel that toggles a CVar for showing the Panel (MotD) on InitialSpawn. I also added a print for debugging. Whenever I check the box now, it prints first:
You set jmotd_show to 0.
You set jmotd_show to 0.
You set jmotd_show to 1.
when I open the panel again it is suddenly unchecked again and when I check it again it says
You set jmotd_show to 0.
Here is my code:
[url]http://pastebin.com/GcfRavTQ[/url]
Now my second problem, which is more a question:
Is there a way to define the positions of DPropertySheet Tabs? Couldn't find anything
1) Remove this line: SheetItemFour:SetValue( 0 ), it resets the checkbox.
2) What do you mean? Order or put the tabs to the side or bottom?
Thanks!
My propertysheets are overlapping, because I made them transparent it doesn't look good. So I want to change the x-position of each tab, if it's possible.
[QUOTE=JayTheSheep;43343897]Thanks!
My propertysheets are overlapping, because I made them transparent it doesn't look good. So I want to change the x-position of each tab, if it's possible.[/QUOTE]
Don't think you can, but you can try dig in lua/vgui/DPropertySheet.lua , more specifically PANEL:PerformLayout.
I have another problem, I can't set the position of my DLabels and they stay at this position:
[url]http://bit.ly/1eTjAWk[/url]
This is my current code:
[url]http://pastebin.com/feQ3y6pP[/url]
Any ideas?
Make a DPanel or DPanelList and put all your labels onto it, then feed that DPanel(List) to DPropertySheet:AddSheet.
[QUOTE=Robotboy655;43580619]Make a DPanel or DPanelList and put all your labels onto it, then feed that DPanel(List) to DPropertySheet:AddSheet.[/QUOTE]
But can I do all the options, like ShowCloseButton and colors for the DFrame, for a DPanel?
What, why? DPanel(List) doesn't have any close buttons, so you can't.
[QUOTE=Robotboy655;43580660]What, why? DPanel(List) doesn't have any close buttons, so you can't.[/QUOTE]
Nvm, I thought I have to replace the DFramew with the DPanel.
So I added the DPanel into the DFrame and said as you told me, but it still doesn't work.
And how to I feed the DPanel to the Sheets?
[url]http://pastebin.com/CiKjiCVC[/url]
...
For each tab, you create a DPanel, put all of your stuff from that tab to that panel, and put the panel to PNL:AddSheet:
[code]
catmotd:AddSheet( "MotD", YOURDPANEL, "icon16/cup.png", true, true)[/code]
Got it now, thanks. Next question: Where/how do I create a draw.RoundedBox behind that DFrame?
In YOURDPANEL:Paint( w, h )
[QUOTE=Robotboy655;43581350]In YOURDPANEL:Paint( w, h )[/QUOTE]
Oh sorry, I explained a bit bad. I mean behind the whole DFrame/Motd, I basiaclly want a half-transparency box which goes all the ScrW and the height of the motd.
Hook up to HUDPaintBackground
The only issue I have now is, that the RoundedBoxes I created, are on different positions with every screen resolution. I tried ScrH()/4 and other variables, but I just can't get it to work.
How do I set the same position for every resolution?
You gotta use a fraction of ScrW() and ScrH(). It depends on what you are trying to do.
For example, I have an HTML object in one of my panel, the height works, but I don't get what I should do with the width.
OneText:SetPos(ScrW(), -180)
the Size of the sheet item:
SheetItemOne:SetSize( 790, 315 )
[url]http://bit.ly/1dk8TaF[/url]
The RoundedBoxes have the same problem on other resolutions.
Ideally you would put the HTML element into the PANEL:AddSheet and set last two arguments to true for automatic sizing.
[editline]19th January 2014[/editline]
I don't see anything else wrong on the pic.
[QUOTE=Robotboy655;43591355]Ideally you would put the HTML element into the PANEL:AddSheet and set last two arguments to true for automatic sizing.
[editline]19th January 2014[/editline]
I don't see anything else wrong on the pic.[/QUOTE]
Ok, got the HTML working now, thanks.
The only problem are the RoundedBoxes now. I made it perfect on 1366x768: [url]http://puu.sh/6qfi6.jpg[/url]
But on 1600x900 for example: [url]http://puu.sh/6qfk9.jpg[/url]
This is what it looks like:
draw.RoundedBox( 0, 0, ScrH()/4.83, ScrW(), 450, Color(0, 0, 0, 200))
draw.RoundedBox( 0, 0, ScrH()/8, ScrW(), 50, Color(0, 0, 0, 200))
I am assuming the height if the panel is fixed, so why don't you just grab the Y position of the panel and put it into your RoundedBox?
Or show me the code you use to create the DFrame.
[QUOTE=Robotboy655;43591448]I am assuming the height if the panel is fixed, so why don't you just grab the Y position of the panel and put it into your RoundedBox?
Or show me the code you use to create the DFrame.[/QUOTE]
Well I tried to do it with
local baseh = base:GetHeight() etc, but I'm sure it doesn't work like this
local base = vgui.Create( 'DFrame' )
base:SetSize( 800, 450 )
How do you position your DFrame?
[QUOTE=Robotboy655;43591460]How do you position your DFrame?[/QUOTE]
with Center()