Download
(57 Kb)
Download
Updated: 12-04-16 12:41 PM
Pictures
File Info
Updated:12-04-16 12:41 PM
Created:10-18-11 07:21 PM
Downloads:10,078
Favorites:11
MD5:
LibSimpleWidgets  Popular! (More than 5000 hits)
Version: 1.14.5
by: doxxx [More]
LibSimpleWidgets is a library which provides a set of simple widgets not provided by the official Rift API. It integrates into the UI.CreateFrame function, adding several new frame types:
  • SimpleCheckbox (checkbox with a label)
  • SimpleGrid (grid of widgets)
  • SimpleList (list of selectable items, single/multi-select)
  • SimpleScrollList (same as above, scrollable, handles very large lists, recommended as replacement for SimpleList+SimpleScrollView)
  • SimpleRadioButton (radio button with a label)
  • SimpleScrollView (wraps any fixed-height frame)
  • SimpleSelect (dropdown list)
  • SimpleSlider (slider with the current value displayed next to it)
  • SimpleTabView (tabbed frames)
  • SimpleTextArea (multi-line textfield in scrollview)
  • SimpleTooltip (mouseover popup frame with text)
  • SimpleWindow (draggable RiftWindow)
The new frame types inherit all of Frame's functions and add a few more functions specific to each widget.

SimpleRadioButton has a companion function called RadioButtonGroup, which returns a controller object that manages a group of radio buttons to ensure that only one is selected at a time and to generate an event when the selected radio button changes.

The Layout function, given a table describing a widget layout, will create frames and lay them out accordingly. If you've ever used AceConfig and AceGUI, then you'll find this familiar. You can call Layout with the same parent frame and config table to refresh the widgets without creating new frames.

You can find the API documentation here: http://rift.curseforge.com/addons/li...documentation/

You can file bugs and feature requests in my author portal.

TODO list
v1.14.5 (4 December 2016)
- Fix SimpleScrollList mouse scrolling bug.
- Add missing Events header in SimpleWindow docs.

v1.14.4 (25 November 2015)
- Fix calculation of minimum scrollbar thickness for SimpleScrollView.

v1.14.3 (23 May 2015)
- Fix recycling of ScrollList item frame's background frames.

v1.14.2 (2 March 2014)
- Fix calls to original mouse events for tooltip injected frames.
- Fix tooltip RemoveEvents to restore original handlers correctly.

v1.14.1 (28 April 2013)
- Add RemoveAllRows function to Grid.
- Fix Grid SetRows to hide old rows.
- Fix ScrollView's content frame resizing to use SetWidth instead of setting a TOPRIGHT point. This prevents a conflict when a Grid has been put into a ScrollView before rows are added to the Grid.
- Raise Select's dropdown layer to ensure that it's on top of everything else.
- Clarify Grid's SetRows documentation.
- Add simple example for Grid to documentation.

v1.14 (27 April 2013)
- Add SimpleGrid widget.
- Fix SimpleSelect's ResizeToFit to take currently selected item width into account.
- Fix SimpleSelect's dropdown layering.
- Add configuration methods to SimpleTabView for colors.
- Change SimpleSelect widget to use SimpleScrollList for dropdown.

v1.13.4 (10 March 2013)
- Fix index param checking in SimpleScrollList's SetSelectedIndex.

v1.13.3 (28 February 2013)
- Fix enter and tab key detection in SimpleTextArea for Rift 2.2.
- Update required environment to 2.2.

v1.13.2 (12 February 2013)
- Fix index param checking in SimpleList's SetSelectedIndex.

v1.13.1 (15 January 2013)
- Fix clicking on SimpleSelect dropdown items.
- Ensure that ScrollList background frame does not interfere with item background frames.

v1.13 (12 January 2013)
- Added SimpleScrollList widget -- scrollable list (like SimpleList) but optimized to handle very large lists without using lots of Rift frames.

v1.12 (22 December 2012)
- Made Select widget's dropdown items scrollable.
- Fixed default sizing of Select widget.
- Includes v1.11.1 fixes.

v1.11.1 (18 December 2012)
- Fixed Tooltip's event injection to pass events onto original handlers as well.
- Fixed Border:Destroy() so that switching border types work.

v1.11 (9 December 2012)
- Added silent parameter to SimpleSlider's SetRange function.
- Properly remove SimpleCheckbox's SetBackgroundColor function.
- Properly remove SimpleRadioButton's SetBackgroundColor function.
- Added rounded and tooltip border styles. This required a change to the argument list for the SetBorder function.
- Use new tooltip border for Tooltip widget.
- Updated SetBorder function to handle both old-style and new-style argument lists and be able to change existing border to a different type.
- Added documentation for SetBorder function.
- Added labelFontSize config setting for checkboxes in Layout function.
- Added anchor support to the Tooltip widget.
- Added 'editable' setting for slider widgets in Layout function.
- Added parameter checking for all frame types and functions.
- Improved positioning of mouse-anchored tooltip to not go over bottom or right screen edge.
- Updated TOC Environment to 2.0.

v1.10 (3 May 2012)
- SimpleTabView: Made tab font size and colors configurable.
- SimpleTabView: Made tab position configurable.
- SimpleTabView: Fixed positioning of remaining tabs when a tab is removed.

v1.9.5 (25 April 2012)
- Added dropdown arrow button to SimpleSelect.
- Added ItemClick event to SimpleList.

v1.9.4 (21 April 2012)
- Made minimum tab width in SimpleTabView configurable.
- Enforce a minimum scrollbar drag button thickness in SimpleScrollView.
- Fixed SimpleScrollView to correctly update its layout when it's resized.

v1.9.3 (8 March 2012)
- Fixed SimpledSlider's SetEnabled to switch to showing the current view when the widget is disabled, since RiftTextfields can't be disabled.
- Removed SimpleCheckbox's and SimpleRadioButton's SetBackgroundColor function so that the default Frame implementation is used.
- Added Get/SetSelectionBackgroundColor function to SimpleList.
- Fixed SimpleList to retain selected item's background color when changing things like font size.

v1.9.2 (7 March 2012)
- Improved how RadioButtons and RadioButtonGroup interact so that they're independent of event handlers.
- Added SetEnabled function to RadioButtonGroup.

v1.9.1 (6 March 2012)
- Fixed error when trying to get an event handler for a custom event (e.g. RadioButtonChange) which had no handler set yet.

v1.9.0 (4 March 2012)
- Added optional editable textfield to SimpleSlider, controlled by Get/SetEditable.
- Fixed SimpleSlider's SetEnabled to actually enable the slider when true is passed.
- Fixed library's addon short name to be "LSW".
- Added silent parameter to SimpleSlider's SetPosition function to suppress the SliderChange event.
- Added silent parameter to SimpleList's selection-changing functions to suppress the ItemSelect and SelectionChange events.
- Added silent parameter to SimpleSelect's selection-changing functions to suppress the ItemSelect events.
- Added silent parameter to SimpleRadioButton's SetSelected function to suppress the RadioButtonSelect event.
- Added SetSelectedIndex function to SimpleRadioButtonGroup.

v1.8.3 (25 February 2012)
- Removed all usage of deprecated Rift API functions and updated required Environment to 1.7.
- Added ResizeToFit functions for SimpleSelect, SimpleCheckbox, SimpleRadioButton, and SimpleSlider.
- Deprecated ResizeToDefault function on SimpleSelect in favor of ResizeToFit.
- Fixed sizing of SimpleTooltip for multiple lines of automatically wrapped text.
- Fixed SimpleSlider's SetBackgroundColor function.
- Improved SimpleTextArea widget to grab key focus when the scroller background is clicked because the text doesn't fill the scroll area. (Thanks TimeBomb!)

v1.8.2 (29 January 2012)
- Fixed scrollbar visibility not tracking scrollview visibility properly. Thanks Xenyr!

v1.8.1 (14 December 2011)
- Fixed nil error when clicking a radio button in a RadioButtonGroup.

v1.8 (11 December 2011)
- Added SimpleRadioButton frame type and RadioButtonGroup function.
- Added TabSelect event and GetActiveTab function to SimpleTabView.

v1.7 (8 December 2011)
- Added SimpleTabView widget.
- Added item levels support to SimpleList.
- Added RemoveEvents to SimpleTooltip.
- Fixed SetBackgroundColor for SimpleList.

v1.6.1 (6 December 2011)
- Added GetSelectedIndices, GetSelectedItems and GetSelectedValues functions to SimpleList.
- Ensure that we never try to position SimpleScrollView's scrollbar outside of its min/max range.

v1.6 (1 December 2011)
- Added multi-select mode to SimpleList. See API documentation for details.

v1.5.4 (30 November 2011)
- Reverted v1.5.2 change and instead fixed SimpleList and SimpleSelect to clear the current selection when SetItems is called. This doesn't trigger an ItemSelect event.

v1.5.3 (30 November 2011)
- Fixed SimpleList and SimpleSelect to trigger an ItemSelect event when the previously selected index is reselected after the list is updated by SetItems.

v1.5.2 (19 November 2011)
- Use a RiftButton with the 'close' skin for the close button on SimpleWindows.
- Use a RiftScrollbar in SimpleScrollView.
- Added GetFontColor/SetFontColor to SimpleTooltip.
- Added GetFontColor/SetFontColor to SimpleCheckbox.

v1.5.1 (16 November 2011)
- Fixed a bug when SimpleScrollView is given a content frame that already has points or sizes set. (Thanks Matrix)
- Fixed a bug when SimpleScrollView is given a content frame that has a height of 0. (Thanks Matrix)

v1.5 (11 November 2011)
- Updated select widget in Layout function to support new values and index features in SimpleSelect.
- The event handlers created by SimpleTooltip's InjectEvents now call the tooltipTextFunc with the tooltip frame as the first parameter.
- Fixed anchoring of SimpleSlider internal frames.
- Added font size support to SimpleCheckbox, SimpleList, SimpleSelect and SimpleTooltip.
- SimpleSelect no longer automatically sets its own width and height when first created.
- Added ResizeToDefault funciton for SimpleSelect.

v1.4 (7 November 2011)
- Added the ability to associate values with items in SimpleList and SimpleSelect.
- Added the ability to use indices with SimpleList and SimpleSelect.
- SimpleList now triggers ItemSelect event when the selection is cleared.
- Reselecting the same item in SimpleList should not trigger the ItemSelect event.
- Fixed "unknown event" bug in EventProxy when a custom event is cleared by setting to nil.
- Layout function can now be used to update an existing widget layout.
- Added spacer type to Layout function.

v1.3.1 (5 November 2011)
- Fixed SetKeyFocus function for SimpleTextArea.

v1.3 (4 November 2011)
- Fix MouseIn/MouseOut/MouseMove events for SimpleCheckbox.
- Don't fire ItemSelect event in SimpleSelect if item is already selected.
- Fixed resizing of underlying textfield as text is changed in SimpleTextArea.
- Fixed SimpleWindow dragging to work when window is initially anchored.
- Improved close button for SimpleWindow.
- Added GetKeyFocus/SetKeyFocus to SimpleTextArea.
- Added missing SetBorder and SetBackgroundColor functions to for SimpleCheckbox, SimpleList and SimpleTextArea.
- Added GetEnabled/SetEnabled functions for SimpleCheckbox, SimpleList, SimpleSelect, SimpleSlider and SimpleTextArea.
- Added Close event to SimpleWindow.
- Added SimpleTooltip widget.
- Added tooltipText setting to config table for Layout function.

v1.2 (25 October 2011)
- Added optional close button to SimpleWindow.
- Added SetBackgroundColor function SimpleSelect.
- Fixed double ItemSelected notification in SimpleList.
- Improved technique used by SetBorder for adding the border. Works with translucent frames now.
- Added SimpleCheckbox widget.
- Added SimpleSlider widget.
- Added Layout function for arrange a set of widgets according to a config table.
- Added EventProxy function which creates a replacement Event table for a frame which contains custom events but can also use the events from the frame's original Event table. This has replaced the Register*Handler functions.
- Added events for various widgets.

v1.1 (22 October 2011)
- Added SimpleTextArea widget.

v1.0 (18 October 2011)
- Initial release.
Optional Files (0)


Archived Files (38)
File Name
Version
Size
Author
Date
1.14.4
57kB
doxxx
11-25-15 05:14 PM
1.14.3
55kB
doxxx
05-23-15 07:22 AM
1.14.2
57kB
doxxx
03-02-14 10:15 AM
1.14.1
57kB
doxxx
04-28-13 11:44 AM
1.14
57kB
doxxx
04-27-13 07:12 PM
1.13.4
55kB
doxxx
03-10-13 04:30 PM
1.13.3
55kB
doxxx
02-28-13 05:47 PM
1.13.2
55kB
doxxx
02-12-13 06:39 PM
1.13.1
55kB
doxxx
01-15-13 06:03 PM
1.13
55kB
doxxx
01-12-13 12:04 AM
1.12
50kB
doxxx
12-22-12 10:53 AM
1.11.1
50kB
doxxx
12-18-12 06:07 PM
1.11
50kB
doxxx
12-09-12 07:54 PM
1.10
36kB
doxxx
05-03-12 06:42 PM
1.9.5
29kB
doxxx
04-25-12 07:49 PM
1.9.4
24kB
doxxx
04-21-12 08:43 AM
1.9.3
23kB
doxxx
03-08-12 07:01 PM
1.9.2
23kB
doxxx
03-07-12 07:17 PM
1.9.1
23kB
doxxx
03-06-12 07:12 PM
1.9.0
22kB
doxxx
03-04-12 09:44 AM
1.8.3
22kB
doxxx
02-25-12 12:32 PM
1.8.2
22kB
doxxx
01-29-12 01:17 PM
1.8.1
22kB
doxxx
12-14-11 07:44 PM
1.8
22kB
doxxx
12-11-11 01:30 PM
1.7
17kB
doxxx
12-08-11 09:27 PM
1.6.1
15kB
doxxx
12-06-11 05:32 PM
1.6
15kB
doxxx
12-01-11 09:55 PM
1.5.4
14kB
doxxx
11-30-11 07:04 PM
1.5.3
14kB
doxxx
11-30-11 05:55 PM
1.5.2
15kB
doxxx
11-19-11 05:51 PM
1.5.1
20kB
doxxx
11-16-11 10:51 PM
1.5
20kB
doxxx
11-11-11 04:57 PM
1.4
19kB
doxxx
11-07-11 07:45 PM
1.3.1
18kB
doxxx
11-05-11 08:13 AM
1.3
18kB
doxxx
11-04-11 07:06 PM
1.2
15kB
doxxx
10-25-11 06:10 PM
1.1
6kB
doxxx
10-22-11 12:34 PM
1.0
5kB
doxxx
10-18-11 07:21 PM


Post A Reply Comment Options
Unread 11-25-11, 10:45 AM  
Grebew

Forum posts: 0
File comments: 3
Uploads: 0
A start would be to be able to set the font size and color (and maybe background) for each list item. that would allow the "look" of a categorized list. maybe an indention level too of a certain # of pixels for each item?

An extension of that would be to have generic "levels" of item in the list, with the ability to set font properties for each level. So a Level 1 item would be like a heading 1, a Level 2 would be a heading 1, a Level 3 would be normal text, etc. You could implement it as an extra property per item. So you would have the item text, the value, and now an item Level, associated with each item index. You could provide default settings for a basic level 1 heading, level 2 heading, and normal text with the ability to modify the look of each. That sounds like "work" so you may have other priorities first. :-)

I love this library so far!! Thanks for providing it!!
Grebew

Quote:
Originally Posted by doxxx
Quote:
Originally Posted by adelea
I've just started using this library in an addon I am writing, and I am loving it so far!

Is it possible to pass in rendering information in the items list for the SimpleList widget?

I want to display (as a list, inside a scroll window)

CATEGORY1
Item1
Item2
SUBCATEGORY1
Item1
Item2
SUBCATEGORY2
Item1
Item2
CATEGORY2
SUBCATEGORY1
Item1
Item2

etc.

I would like to be able to mark the category and subcategory values somehow (textcolor/background maybe), and have these non-selectible.
Not currently possible but an interesting idea. I'll give it some thought.
Grebew is offline Report comment to moderator  
Reply With Quote
Unread 11-25-11, 04:25 AM  
adelea
Claw of Regulos
AddOn Author - Click to view AddOns

Forum posts: 22
File comments: 285
Uploads: 6
Quote:
Originally Posted by doxxx
Would you rather have a multi-select style list where clicking a selected item again would unselect it?
Oh, yes - that would be nice!
adelea is offline Report comment to moderator  
Reply With Quote
Unread 11-24-11, 05:43 PM  
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 106
Uploads: 1
Quote:
Originally Posted by adelea
One more that has cropped up =)

Is it possible to have every click on a list reported back to the addon?

I display a list inside a scrollwindow that is used to select which things to display. Clicking on something acts as a toggle, so clicking it once adds it, and a second click removes it.

Now, if the user clicks on Item1, if they want to remove it, they need to click on ItemX, then click back on Item1, then again on ItemX to remove that too.
Would you rather have a multi-select style list where clicking a selected item again would unselect it?
doxxx is offline Report comment to moderator  
Reply With Quote
Unread 11-24-11, 04:41 PM  
adelea
Claw of Regulos
AddOn Author - Click to view AddOns

Forum posts: 22
File comments: 285
Uploads: 6
One more that has cropped up =)

Is it possible to have every click on a list reported back to the addon?

I display a list inside a scrollwindow that is used to select which things to display. Clicking on something acts as a toggle, so clicking it once adds it, and a second click removes it.

Now, if the user clicks on Item1, if they want to remove it, they need to click on ItemX, then click back on Item1, then again on ItemX to remove that too.
adelea is offline Report comment to moderator  
Reply With Quote
Unread 11-21-11, 08:53 AM  
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 106
Uploads: 1
Quote:
Originally Posted by adelea
I've just started using this library in an addon I am writing, and I am loving it so far!

Is it possible to pass in rendering information in the items list for the SimpleList widget?

I want to display (as a list, inside a scroll window)

CATEGORY1
Item1
Item2
SUBCATEGORY1
Item1
Item2
SUBCATEGORY2
Item1
Item2
CATEGORY2
SUBCATEGORY1
Item1
Item2

etc.

I would like to be able to mark the category and subcategory values somehow (textcolor/background maybe), and have these non-selectible.
Not currently possible but an interesting idea. I'll give it some thought.
doxxx is offline Report comment to moderator  
Reply With Quote
Unread 11-21-11, 05:43 AM  
adelea
Claw of Regulos
AddOn Author - Click to view AddOns

Forum posts: 22
File comments: 285
Uploads: 6
I've just started using this library in an addon I am writing, and I am loving it so far!

Is it possible to pass in rendering information in the items list for the SimpleList widget?

I want to display (as a list, inside a scroll window)

CATEGORY1
Item1
Item2
SUBCATEGORY1
Item1
Item2
SUBCATEGORY2
Item1
Item2
CATEGORY2
SUBCATEGORY1
Item1
Item2

etc.

I would like to be able to mark the category and subcategory values somehow (textcolor/background maybe), and have these non-selectible.
adelea is offline Report comment to moderator  
Reply With Quote
Unread 11-19-11, 05:52 PM  
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 106
Uploads: 1
I've uploaded v1.5.2 which makes use of the new 'close' skin in RiftButton for the close button on SimpleWindow and the new RiftScrollbar in SimpleScrollView.
doxxx is offline Report comment to moderator  
Reply With Quote
Unread 11-17-11, 02:58 AM  
Daviana

Forum posts: 0
File comments: 5
Uploads: 0
Thanks, latest patch fixes my errors
Daviana is offline Report comment to moderator  
Reply With Quote
Unread 11-16-11, 10:54 PM  
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 106
Uploads: 1
Thanks Matrix, I've just uploaded v1.5.1 which fixes both of those errors.
doxxx is offline Report comment to moderator  
Reply With Quote
Unread 11-15-11, 08:28 PM  
Matrix

Forum posts: 0
File comments: 4
Uploads: 0
Quote:
Originally Posted by Daviana
Perhaps this error is the same one as that which Matrix found?
Yes, this is the error related to div/0 -> nan.
Matrix is offline Report comment to moderator  
Reply With Quote
Unread 11-15-11, 05:40 PM  
Daviana

Forum posts: 0
File comments: 5
Uploads: 0
Perhaps this error is the same one as that which Matrix found?

I get this error from my add-on:

23:34:29: [Slacker Tracker] Error: Y axis: Positions and offsets must be valid numbers.
23:34:29: [Slacker Tracker] In SlackerTracker / SlackerTracker.listBox:Size
23:34:29: [Slacker Tracker] stack traceback:
23:34:29: [Slacker Tracker] [C]: in function 'SetPoint'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:44: in function 'PositionScrollbar'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:16: in function 'ContentResized'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:90: in function <LibSimpleWidgets/scrollview.lua:89>
23:34:29: [Slacker Tracker] [C]: in function 'SetPoint'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:39: in function 'PositionContent'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:15: in function 'ContentResized'
23:34:29: [Slacker Tracker] LibSimpleWidgets/scrollview.lua:124: in function 'SetContent'
23:34:29: [Slacker Tracker] SlackerTracker/SlackerTrackerConfig.lua:166: in function 'CreateListPanel'
23:34:29: [Slacker Tracker] SlackerTracker/SlackerTrackerConfig.lua:40: in function 'Create'
23:34:29: [Slacker Tracker] SlackerTracker/SlackerTracker.lua:272: in function 'CreateConfigUI'
23:34:29: [Slacker Tracker] SlackerTracker/SlackerTracker.lua:830: in function <SlackerTracker/SlackerTracker.lua:826>

Line 166 is the last line of the following code:

local margin = 30
local minimumWarningTime = 0
local maximumWarningTime = 120

local pnl = UI.CreateFrame("Texture", "Solid", rightPanel)
pnl:SetPoint("TOPLEFT", rightPanel, "TOPLEFT")
pnl:SetPoint("BOTTOMRIGHT", rightPanel, "BOTTOMRIGHT")
pnl:SetTexture("SlackerTracker", "Resources/RightConfigFrame.png")
pnl:SetVisible(false)

pnl.listScrollView = UI.CreateFrame("SimpleScrollView", "listScrollView", pnl)
pnl.listScrollView:SetPoint("TOPLEFT", pnl, "TOPLEFT", margin, margin)
pnl.listScrollView:SetWidth(pnl:GetWidth() - 2 * margin)
pnl.listScrollView:SetHeight(300)
pnl.listScrollView:SetBorder(1, 1, 1, 1, 1)

pnl.listBox = UI.CreateFrame("SimpleList", "listBox", pnl.listScrollView)
pnl.listBox:SetItems(list)

pnl.listScrollView:SetContent(pnl.listBox)
Daviana is offline Report comment to moderator  
Reply With Quote
Unread 11-15-11, 04:26 AM  
Matrix

Forum posts: 0
File comments: 4
Uploads: 0
Quote:
Originally Posted by doxxx
Quote:
Originally Posted by Daviana
Thanks for the great add-on. I am hoping to get my new add-on ready for 1.6 but I am also having problems that RageBeastRT saw. Hope you get time to look at this quickly
Which problems? Version 1.5 should have fixed all the problems mentioned so far.
I just did a quick diff between 1.4 and 1.5 and yes you did fix it in slider.lua but a similar error is thrown in scrollview.lua as well.

Quote:
Error: X Axis: An axis with a set size cannot have more than one unique set point.
stack traceback:
[C] in funtion 'SetPoint'
LibSimpleWidgets/scrollview.lua:39: in function 'PositionContent'
LibSimpleWidgets/scrollview.lua:15: in function 'ContentResized'
LibSimpleWidgets/scrollview.lua:124: in function 'SetContent'
From your code I understand that you want to keep the content the same width as the scrollview is. That's fine, but then you need to clear any existing width and possibly other anchors as well. Since this is a lib you never know what the user will have set on the frame that he is sending as input to the SetContent function. So at least once for every SetContent call you need to clear the old points and the old width (but keep the height, because you rely on it).

Ideally you would want to clear the old points+width in every call of PositionContent, but I don't know what's the overhead of these Clear... calls. If the user is setting different points after calling SetContent then the error will be thrown in his code anyway, so I wouldn't worry much about making it too robust at the expense of performance. If I were you I would go with a simple fix in SetContent.

Something like this in SetContent should solve the problem:
Code:
local height = content:GetHeight()
content:ClearAll()
content:SetHeight(height)
As a bonus, here is another error I found. When you are setting the position of the scroller you are dividing with content height but you don't check if it's 0 (for any reason). There is no error for div/0, but setting a point with a nan offset throws one.

Code:
local function PositionScrollbar(self)
  local scrollbarOffset = self.offset / self.content:GetHeight() * self:GetHeight()
  if scrollbarOffset ~= scrollbarOffset then  -- nan check
    scrollbarOffset = 0
  end
  self.scrollbar:SetPoint("TOPRIGHT", self, "TOPRIGHT", 0, scrollbarOffset)
end
Nice lib and good job so far
Last edited by Matrix : 11-15-11 at 04:30 AM.
Matrix is offline Report comment to moderator  
Reply With Quote
Unread 11-15-11, 12:39 AM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
Quote:
Originally Posted by doxxx
Quote:
Originally Posted by Daviana
Thanks for the great add-on. I am hoping to get my new add-on ready for 1.6 but I am also having problems that RageBeastRT saw. Hope you get time to look at this quickly
Which problems? Version 1.5 should have fixed all the problems mentioned so far.
I have an update almost ready for 1.6, really jsut waiting for the patch and then I can change the toc file. I ran it on pts for awhile and never had any bugs since the last update. I only use simplewindow, scrollwindow, list, select, slider and tooltips though. I have tons of frames but not sure how to use the layout correctly so pretty much everything is just hard-coded except text strings.
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Unread 11-14-11, 05:54 PM  
doxxx
Claw of Regulos
 
doxxx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 106
Uploads: 1
Quote:
Originally Posted by Daviana
Thanks for the great add-on. I am hoping to get my new add-on ready for 1.6 but I am also having problems that RageBeastRT saw. Hope you get time to look at this quickly
Which problems? Version 1.5 should have fixed all the problems mentioned so far.
doxxx is offline Report comment to moderator  
Reply With Quote
Unread 11-13-11, 04:08 AM  
Daviana

Forum posts: 0
File comments: 5
Uploads: 0
Thanks for the great add-on. I am hoping to get my new add-on ready for 1.6 but I am also having problems that RageBeastRT saw. Hope you get time to look at this quickly
Daviana is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: