Thread Tools Display Modes
01/24/15, 06:54 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
ZO_ScrollList

I'm wondering if anyone can tell me whats going on with this. I can't figure it out.

The code is sloppy, I was just trying to get it all to work...but the problems I'm having don't seem like they are coming from my code.
If you need to look at it though, its a bit, so I pasted it on pastebin, but I think the pictures below pretty much explain the problem.
PasteBin LUA code
PastBin XML Code

I put together a bunch of pictures, which might make more sense than me going into great detail.

The short of it is I'm trying to create/use a ZO_ScrollList, I'm giving items/controlData categoryIds when I add them to the scroll list, & then my problem is with these two lines of code:
Lua Code:
  1. ZO_ScrollList_HideAllCategories(TweakItScrollList)
  2. ZO_ScrollList_ShowCategory(TweakItScrollList, currentId)

I'm running into problems when the scroll list is empty, or if it only contains 1 item in it.

Problem 1:
ZO_ScrollList_HideAllCategories(TweakItScrollList) doesn't work properly if there is only 1 activeControl. Notice theres still an image of the control, but its no longer there.


I would have assumed it was a mistake in my code somewhere, but the only time it doesn't work is if there is only 1 active control. It always works if there are several active controls:



Problem 2:
If I hide all categories and then show a category with only 1 active control in it AT THE SAME TIME...it works.


Compare the above picture with the one below...I don't get how the one above can work, but the one below does not work.

If I start with items/categories already in the list and do both of these at the same time it works.
I'm running them in ZAM Notebook.
Lua Code:
  1. ZO_ScrollList_HideAllCategories(TweakItScrollList)
  2. ZO_ScrollList_ShowCategory(TweakItScrollList, 3)

It hides all of the categories/items. So at some point the list is empty, but it still works (it should)...
However If I start with an empty list. If I only run the code:
Lua Code:
  1. ZO_ScrollList_HideAllCategories(TweakItScrollList)
and wait until after its finished and the window is empty, I have an empty list...and then I try to run:
Lua Code:
  1. ZO_ScrollList_ShowCategory(TweakItScrollList, 3)

It does not work properly. The control gets added & its actually there, you can click on it, you just can't see it.


But then again...If you start with an empty list & add a category that has more than one item/control...It works just fine.


Any Ideas??

Last edited by circonian : 01/24/15 at 11:36 AM.
  Reply With Quote
01/24/15, 10:44 AM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
TopLevelControl name="WayPointButton"

Make it Control. TopLevelControls behave strangely when they're not actually top-level, they don't show/hide when you tell them to. I ran into the same issue with LAM, which creates everything as TopLevelControl.


ZO_ScrollList_AddDataType(tlw, ROW_TYPE_ID, "WayPointButton", 70, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)

Probably not the issue, but you should use nil for the callbacks you don't define to avoid nasty surprises when these names appear in _G. Also, selectSound should be sound identifier (SOUNDS.ITEM_MONEY_CHANGED), not a function playing it.
  Reply With Quote
01/24/15, 11:03 AM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
TopLevelControl name="WayPointButton"

Make it Control. TopLevelControls behave strangely when they're not actually top-level, they don't show/hide when you tell them to. I ran into the same issue with LAM, which creates everything as TopLevelControl.
Arrgg, to simple. I copied that code from one of my other addons & just modified it. Sad thing is now that I think about it, I did the same thing & had the same problem when I wrote LootIt, I should have caught that.

Originally Posted by merlight View Post
ZO_ScrollList_AddDataType(tlw, ROW_TYPE_ID, "WayPointButton", 70, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)

Probably not the issue, but you should use nil for the callbacks you don't define to avoid nasty surprises when these names appear in _G.
Ha ya, there are a lot of really bad things in that code . I usually just start writing stuff and changing it until I can figure out how to get it to work & then try to clean it up. I left those in there, for now, so I remember what their supposed to be so I don't have to look it up later when I'm ready to add that part.
Edit: Although your right, it could still cause problems while testing, I guess I should stop doing that.

Originally Posted by merlight View Post
Also, selectSound should be sound identifier (SOUNDS.ITEM_MONEY_CHANGED), not a function playing it.
Ah Ha ! Thats why I couldn't get that one to work. Yeah I go back and look at the code comments again and it does say that, guess I read it wrong.

Your Awesome Thanks for the help!

Last edited by circonian : 01/24/15 at 11:09 AM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » ZO_ScrollList Bug?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off