Derma questions

I have a couple of questions about the derma menu’s in lua. One, the SetPos( x, y ), what does this do exactly is the x, y the centre of the panel or one of the corners. Two, rather than make a console command (e.g. concommand.Add(“open_menu”, ProfilePanel) ) is it possible to bind it automatically to say, F1?

To bind it to F1 you will need to add this to cl_init (I’d do it this way, but there’s probly a better way, look for other answer too)
The derma menu initial pos is at the top left corner i think.
X is >
Y is v



function f1( ply )
 
	ply:ConCommand( "open_menu" )
end 
hook.Add("ShowHelp", "open_menu", f1)

Edit:(I’m not sure about this, correct me if i’m wrong) If you don’t want a console command you could try usermessages
Add something like that under your menu last end


usermessage.Hook( "open_menu", yourdermaframename )

And then for the code i gave you first modify it like that :



function f1( ply )
 
	umsg.Start("open_menu", ply)
	umsg.End()
end 
hook.Add("ShowHelp", "open_menu", f1)

If your doing stuff in sandbox go to - garrysmod/garrysmod/gamemodes/sandbox/gamemode/init.lua

Then search “Help” and then edit the GM:ShowHelp( ply ) function

Thanks, also i know X is > and Y is v i mean like from what point is it from, for example, is 0,0 the centre of the panel. Or is it something like a corner?

The derma menu initial pos is at the top left corner i think.

Yea, Wolves is right, it’s at the top left.

Also, rather than start a new post i have another question about derma. If i have two collapsable menu’s, is it possible to make one move down if the other is open? By this i mean if i have one with a SetPos( 140, 175 ) and another with SetPos( 140, 200 ), could i make the second one add say 100 to it’s Y pos whenever the first is open; so
closed = SetPos( 140, 175 ) AND SetPos( 140, 200 )
open = SetPos( 140, 175 ) AND SetPos( 140, 300 )

Actually, i’ll just post a new thread.