PDA

View Full Version : Slider question



mpg732
August 9th, 2009, 04:01 PM
I would like to have a slider that would move a panel with buttons, up or down. On my PPC I have a scene that has more buttons then I have room for. So I would like to have a slider on the side of my scene that would allow me to shift the panel up and down to have access to the other buttons. Can this be done and if so how?

thanks, Mike

Rob H
August 9th, 2009, 06:25 PM
I've never tried doing that, but if you can use a looped frame you can use the supplied ListManager.lua to do something like that. Alternatively you can use hidden frames to do something like this.

dsmes
August 11th, 2009, 10:09 PM
I use the following Lua code (in the CCF Lua file) to move a menu horizontally with a slider. Check the help file for syntax and you should be able to move vertically (up & down) to accomplish what you are after. Good luck!

function MoveIntelliMenu(x) -- Have a CCF button trigger this function. The variable "x" is how far you want the menu to move (in pixels)
local el = NetRemote.GetElementByName("Scrolling Menu Holder") -- within quotes is the CCF frame name
if (el) then
el:SetPosition(360-x*120, 0, false) -- this is the command that moves the frame within the CCF, note that math is performed on the "x" variable
end
end;

Rob H
August 12th, 2009, 05:39 AM
That's good thinking, that should work

mpg732
August 12th, 2009, 05:36 PM
Thanks, not sure how this all works yet but will play around with it.

Mike

mpg732
August 15th, 2009, 09:17 PM
ok, been playing arround witth this for a few days and can not get a slider nor a button to move a fram. I copied this into the CCF lua file "local el = NetRemote.GetElementByName("Scrolling Menu Holder") -- within quotes is the CCF frame name
if (el) then
el:SetPosition(360-x*120, 0, false) -- this is the command that moves the frame within the CCF, note that math is performed on the "x" variable
end" and saved it. not sure what to do next to get a slider to move the fram.

mpg732
August 17th, 2009, 02:28 PM
Bump, I got it to work with using a button, I can not get it to work with a slider, how do you configure a slider to change the variable of "X".....

Rob H
August 17th, 2009, 06:28 PM
Just use X as the variable that the slider is displaying

mpg732
August 18th, 2009, 09:46 PM
Ok, like I said I am new to this, How do you do that?

Rob H
August 18th, 2009, 09:53 PM
In the property grid, click on the Component property and edit the slider, and enter the name of the variable in the slider properties.

mpg732
August 18th, 2009, 10:44 PM
THAT DOES NOT WORK.........

Useing the example of the LUNA CODE that dsmes posted above what is the variable name that I should use? Just putting X in the "Variable field" of the slider properties does nothing......

mpg732
August 23rd, 2009, 01:05 PM
bump, can any one help me with this please

Rob H
August 23rd, 2009, 03:36 PM
If you put X in the variable field it will change a variable called X

You'd need to use something like


NetRemote.RegisterVariableWatch('X', function(var, value) MoveIntelliMenu(value) end)

in the .lua file to call the MoveIntelliMenu function when the value changes

mpg732
August 23rd, 2009, 08:31 PM
Does not work, below is every thing I have in my Lua file

NetRemote.RegisterVariableWatch("MP.Volume", NetRemote.GetPlugin('MediaBridge'))
NetRemote.RegisterVariableWatch('X', function(var, value) MoveIntelliMenu(value) end)
function MoveIntelliMenu(x) -- Have a CCF button trigger this function. The variable "x" is how far you want the menu to move (in pixels)
local el = NetRemote.GetElementByName("test") -- within quotes is the CCF frame name
if (el) then
el:SetPosition(x, 10, false) -- this is the command that moves the frame within the CCF, note that math is performed on the "x" variable
end
end;

Can you see anyhing I am missing

dsmes
August 23rd, 2009, 10:42 PM
I think you need to move the NetRemote.RegisterVariableWatch() calls to the end of the Lua script. Otherwise, you are referencing a function that is not yet defined.

mpg732
August 24th, 2009, 01:27 PM
dsmes, I believe I tried that last night, but I will go home tonight and move it again.

Thanks,
Mike

mpg732
August 25th, 2009, 04:22 PM
OK I got it to work, dsmes you were right, I had to move it to the end, also I Just copied and past your guys example. I didn't catch that one used an lower case x and the other used an upper case x in the two sample of LUA code. Once I changed the case of x it worked.

Thanks guys
mike