[Library] SliderControl - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Library] SliderControl (/showthread.php?tid=70900)
[Library] SliderControl by Eljay on 01-21-2007 at 02:42 PM
SliderControl Library
This is just a small library that makes SliderControls easier to control (pun not intended), with the following features:
-Set the position of a SliderControl (SliderControl_SetPosition)
-Get the position of a SliderControl (SliderControl_GetPosition)
-Trigger a custom event when the SliderControl is moved (OnWindowIdEvent_SliderPositionChanged)
Steps needed to use this library:
-Extract the attached zip to your script's folder
-Register your control with SliderControl_Register (You only need this if you are going to use the SliderPositionChanged event)
-Register the MessageNotification event with the SliderControl message handler (Again, only needed for the event, see example usage for more info)
-That's all folks, you're now ready to use this library!
Example Usage:
code: /*----------
Example Usage of SliderControl
In this example the window is called SliderExample, and the SliderControl's Id is TestSlider.
----------*/
var SliderExample = MsgPlus.CreateWnd("Example.xml", "SliderExample");
/* This just registers a few details the library needs */
SliderControl_Register(SliderExample, "TestSlider");
/* This handles the messages for when the user moves your SliderControl */
/* If you already use MessageNotification for other messages, simply trigger the
SliderControl_MessageHandler function inside your existing MessageNotification, passing
all the same parameters, e.g:
function OnSliderExampleEvent_MessageNotification(PlusWnd, Message, wParam, lParam){
//Your other message handling stuff here
SliderControl_MessageHandler(PlusWnd, Message, wParam, lParam);
}
*/
var OnSliderExampleEvent_MessageNotification = SliderControl_MessageHandler;
/* This event is triggered when the Slider is moved by the user */
function OnSliderExampleEvent_SliderPositionChanged(PlusWnd, ControlId, Position){
Debug.Trace(PlusWnd.WindowId + "->" + ControlId + " is now at position " + Position);
}
/* This function sets the position of the specified SliderControl (duh) */
SliderControl_SetPosition(SliderExample, "TestSlider", 50);
/* And this function gets the current position of the specified SliderControl */
var Position = SliderControl_GetPosition(SliderExample, "TestSlider");
Known problems:
-Doesn't work for vertically oriented SliderControls, working on it. FIXED
What'cha waiting for? DOWNLOAD
RE: [Library] SliderControl by plus on 01-21-2007 at 02:52 PM
yes, I really need this thanks
Great
RE: [Library] SliderControl by effection on 01-21-2007 at 11:46 PM
nice could come in useful
RE: [Library] SliderControl by matty on 01-21-2007 at 11:56 PM
Awesome looks good EllyJelly!
RE: [Library] SliderControl by vikke on 01-22-2007 at 11:19 AM
Awesome! Works like a charm
RE: [Library] SliderControl by bigbob85 on 02-01-2008 at 12:23 AM
I cant get it to work... , Copy pasted the code, and made my interface window like this..
code: <Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Window Id="SliderExample" Version="1">
<Position ClientWidth="310" ClientArea="172" Width="310" Height="172"/>
<DialogTmpl/>
<Controls>
<Control xsi:type="ScrollBarControl" Id="TestSlider">
<Position Left="200" Top="5" Height="100" Width="10" />
</Control>
</Controls>
</Window>
</Interfaces>
Also, having a <VerticalBar/> in there didnt help either.. Any ideas?
RE: [Library] SliderControl by Eljay on 02-01-2008 at 12:29 AM
quote: Originally posted by bigbob85
<Control xsi:type="ScrollBarControl" Id="TestSlider">
<Position Left="200" Top="5" Height="100" Width="10" />
</Control>
Should be a SliderControl, hence the name of the library.
RE: [Library] SliderControl by bigbob85 on 02-01-2008 at 05:30 AM
* bigbob85 feels dumb...
Any idea how to use scrollbars?
Neva mind, I have an idea, ill make a thread about it.
* bigbob85 feels even more stupid when he realises his thread is not related to what he intended.
RE: [Library] SliderControl by tribbium on 08-29-2009 at 08:22 AM
Hey, I've just implemented your code and it works great for the most part, but I had to rehash some of it to get it to work perfectly =P
Is there any reason the following condition wouldn't be detected properly?
code: if(typeof(GlobalScope[EventName]) == "function"){
GlobalScope[EventName](PlusWnd, SliderControlArray[lParam], NewPosition);
}
It returns that the type of this event is undefined =\. I replaced that bit and based on the code I threw together, I know that its there and works:
code: eval (EventName + "(PlusWnd, SliderControlArray[lParam],NewPosition);")
Anyone know the reason this could be?
|