Tutorial
Below is a basic overview of StarTip's widgets and how you can take full control over your widget by referencing the local member 'self'.
If you want to stop a repeating widget from updating, just use
self:Stop()
Do not do self:Update() ;) I may place a safeguard in place to prevent this bomb from occurring.
Let's start with the Text widget.
1 ) First of all, your widget has a name. Reference that with 'self.name'.
2 ) Your widget has an error object that will print some message, paying attention to StarTip's set error verboseness. Usage: self.error:Print("Error", 2)
3 ) You can change your widget's code string by referencing 'self.value'
4 ) Your widget can have a 'prefix' and a 'postfix'
5 ) Each widget has a 'self.color'
6 ) Each widget has a precision, which isn't actually working at the moment. But you should be able to modify how many digits are shown in numeric returns.
7 ) Each widget has an 'align' member, which can be changed by using
WidgetText.ALIGN_LEFT, WidgetText.ALIGN_CENTER, WidgetText.ALIGN_RIGHT, WidgetText.ALIGN_MARQUEE, WidgetText.ALIGN_AUTOMATIC, WidgetText.ALIGN_PINGPONG = 1, 2, 3, 4, 5, 6 self.align = WidgetText.ALIGN_LEFT
8 ) Each widget has an 'update' member which is used to adjust how fast the widget updates. Note that setting this value to 0 will stop the timer all together.
9 ) Each widget has a 'repeating' member. If false then self:Update() will only be called once once self:Start() is called internally.
10 ) Each widget has a 'speed' member. This value is used to determine how fast marquee text will scroll. Note that setting this value to 0 will stop the timer all together.
11 ) Each widget has a 'direction' member.
WidgetText.SCROLL_RIGHT, WidgetText.SCROLL_LEFT = 1, 2 self.direction = WidgetText.SCROLL_RIGHT
12 ) Each widget has a 'cols' member, indicating how many character cells wide the marquee text should be.
13 ) Each widget has a 'dontRtrim' member, indicating whether to trim whitespace to the right of the resulting text or not.
Lastly you can feed self:Init(config) with all new parameters. I don't see this being very useful though. You would have to provide all fields at once.
Comments