UI Toolkit

Reply

Items in ListPanel don't show up before event

Hey,

 

I got a ListPanel in a Scene.

I use these to populate them :

pnlItemsList.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible;
pnlItemsList.SetListItemCreator(ListItemCreator);
pnlItemsList.SetListItemUpdater(ListItemUpdator);
pnlItemsList.Sections = section;

 But the ListItemCreator and Updator only trigger when I do the slide movement in my scene.

So when the scene start, I don't see anything until I do a slide. What could be the problem?

(I looked at the UI_Catalog example but dont"t see any difference)

 

Thanks in advance

Please use plain text.

Re: Items in ListPanel don't show up before event

At first sight I do not see anything that could explain it in your code.

 

Did you use a breakpoint in the ListItemCreator and ListItemUpdator methods to check when it triggers that code?

 

Some questions to find the reason:

How is the section variable defined and where/when is it filled?

Is the code you provided located in the constructor of the scene?

Is the ListPanel placed directly on the scene or indirectly using another panel?

 

 

 

Please use plain text.

Re: Items in ListPanel don't show up before event

Thanks for the reply.

 

1) The code in my first post is situated in the initialize method (this is triggered in the constructor of the class)

2) How can I check by what it is triggered (when using breakpoints)?

3) The listPanel is placed directly on my scene.

4) I use this for my sections :

static private ListSection listSection = new ListSection(constantClass.LlblFeedScrollHeader, listItemStrings.Count);

Please use plain text.

Re: Items in ListPanel don't show up before event

[ Edited ]

Ok,

 

1. Is your initialize method called after calling the method InitializeWidget(); in the constructor?

 

2. One of the debug windows is called Call stack. When the breakpoint is reached, choose: view | Debug windows | Call stack.

 

3. Ok.

 

4. Not sure if that's correct as you did not show how and where section is defined.

 

Do you use something like this for section?

static private ListSectionCollection section = new ListSectionCollection {

  listSection;

}

 

Further, does listItemStrings already contain values when creating an instance for your listSection?

 

 

Please use plain text.

Re: Items in ListPanel don't show up before event

1. This is in my InitializeWidget() :

listSection = new ListSection("Feeds", list.Count); 
			section = new ListSectionCollection { listSection };



            // pnlItemsList
pnlItemsList.ShowEmptySection = false;
pnlItemsList.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible;
pnlItemsList.SetListItemCreator(ListItemCreator);
pnlItemsList.SetListItemUpdater(ListItemUpdator);
pnlItemsList.Sections = section;

 and I got these methods for the creator and updater :

private ListPanelItem ListItemCreator()
        {
            return new pnlItemFeed();
        }

        public void ListItemUpdator(ListPanelItem item)
        {	
			if (item is pnlItemFeed)
            {
				RssList.Add((pnlItemFeed)item);
            }
			foreach (pnlItemFeed _item in RssList)
			{
					pnlItemFeed x = (pnlItemFeed) _item;
					x.Title = list[_item.Index].Title;
					x.Description = list[_item.Index].Description;
					x.ReadMore = constantClass.LbtnReadMore;
			}
        }

 But these only get trigger when the slide event is triggered.

 

2. This is the call stack.

RssReader2.scnItems.ListItemCreator () in c:\Users\Wim\Dropbox\RssReader2\RssReader2\UI\scnItems.composer.cs:105
Sce.Pss.HighLevel.UI.ListPanel.CreateListItem () in 
Sce.Pss.HighLevel.UI.ListPanel.SetNextListItem (nextPos=47, nextAllIndex=0, nextSctionIndex=0, nextIndexInSection=0) in 
Sce.Pss.HighLevel.UI.ListPanel.SetNextItem (nextPos=47) in 
Sce.Pss.HighLevel.UI.ListPanel.UpdateItems (scrollDistance=-21,00003) in 
Sce.Pss.HighLevel.UI.ListPanel.DragEventHandler (sender={Sce.Pss.HighLevel.UI.DragGestureDetector}, e={Sce.Pss.HighLevel.UI.DragEventArgs}) in 
Sce.Pss.HighLevel.UI.DragGestureDetector.OnTouchEvent (touchEvents={Sce.Pss.HighLevel.UI.TouchEventCollection}) in 
Sce.Pss.HighLevel.UI.Widget.SendTouchEventToGestureDetectors (touchEvents={Sce.Pss.HighLevel.UI.TouchEventCollection}) in 
Sce.Pss.HighLevel.UI.Widget.OnTouchEvent (touchEvents={Sce.Pss.HighLevel.UI.TouchEventCollection}) in 
Sce.Pss.HighLevel.UI.ListPanel.OnTouchEvent (touchEvents={Sce.Pss.HighLevel.UI.TouchEventCollection}) in 
Sce.Pss.HighLevel.UI.UISystem.CallTouchEventHandlers (allTouchEvents={Sce.Pss.HighLevel.UI.TouchEventCollection}, isUpdatePrimaryTouchEvent=true) in 
Sce.Pss.HighLevel.UI.UISystem.SendTouchDataList (touchDataList=Count=1) in 
Sce.Pss.HighLevel.UI.UISystem.Update (touchDataList=Count=1) in 

 

 

But I think the problem is that the 2 methods from 1) don't get triggered on the initialisation. But I don't know why

Please use plain text.

Re: Items in ListPanel don't show up before event

[ Edited ]

Wish I could just say why...

Until now, it is also not clear to me why the methods do not get triggered in your case.

I use PanelLists and they just work fine. So it is not impossible to get it workng.

 

But...

What I still cannot see from your code examples is where the variable list is filled.

Your first line says: listSection = new ListSection("Feeds", list.Count);

 

If this list variable is still empty at that time, list.Count will be 0 and it would result in an empty listsection which could explain why the event is not triggered at that time.

 

Further (if that's not the case), it may help to simplify your code a bit (put some code in comments for testing purposes).

Especially in your ListItemUpdator as you are doing some other stuff there with another list (RssList) that looks a bit strange to me at first sight (probably because I do not know the whole context of what you are trying to do there)

Maybe you can start by using only something like this:

public void ListItemUpdator(ListPanelItem item)        

{

 if (item is pnlItemFeed)

 {

  pnlItemFeed x = (pnlItemFeed)item;

  x.Title = "test";

  x.Description = "test";

  x.ReadMore = constantClass.LbtnReadMore;

 }

}



 

 

 

 

 

 

Please use plain text.

Re: Items in ListPanel don't show up before event

I actually do :

            listSection = new ListSection("Feeds", list.Count);
            section = new ListSectionCollection { listSection };

And this works fine, section has 20 items.

 

There is no point simplyfing that updator method since it doesn't get triggered when initializing the class.

But thanks anyway!

 

 

Please use plain text.

Re: Items in ListPanel don't show up before event

Ok,

unfortunately I could not provide a solution for this yet...

 

But there is one thing that I just noticed which may help you further ...

Another message you posted about: Setting an existing Scene()

 

Is that topic about the same source code as this one?

In that case, the approach you have chosen for setting scenes might be worth investigating as it could be the cause for this problem.

 

Please use plain text.

Re: Items in ListPanel don't show up before event

Hi MisterCookie,

Are you still having problems getting it to run? Is it possible to post us your complete code (dropbox, etc.)?

Alternatively if you would like me to post a clean example of using a ListPanel, please let me know.

Thanks
James
PlayStation®Mobile Dev Team
Please use plain text.

Re: Items in ListPanel don't show up before event

using System;
using System.Collections.Generic;
using Sce.Pss.Core;
using Sce.Pss.Core.Imaging;
using Sce.Pss.Core.Environment;
using System.Collections.ObjectModel;
using Sce.Pss.HighLevel.UI;

namespace RssReader2
{
    partial class scnItems
    {
        ImageBox ImageBox_1;
        ListPanel pnlItemsList;
        Button btnGoBack;
        Label lblFeedTitle;
		private Scene menuScene = null;
		private static Collection<Rss.Items> list;
		static List<pnlItemFeed> RssList;
		private static RssManager reader;
		private ListSection listSection;
		private string feedName = "";
        private ListSectionCollection section;
        
        private void InitializeWidget()
        {
           InitializeWidget(LayoutOrientation.Horizontal,"");
        }
        private void InitializeWidget(string filename)
        {
            InitializeWidget(LayoutOrientation.Horizontal,filename);
        }
		
		public Scene getMainMenuScene()
		{
			return menuScene;
		}
		
        private void InitializeWidget(LayoutOrientation orientation,string selectedFeedName)
        {
            ImageBox_1 = new ImageBox();
            ImageBox_1.Name = "ImageBox_1";
            pnlItemsList = new ListPanel();
            pnlItemsList.Name = "pnlItemsList";
            btnGoBack = new Button();
            btnGoBack.Name = "btnGoBack";
            lblFeedTitle = new Label();
            lblFeedTitle.Name = "lblFeedTitle";
			menuScene = new Scene();
			reader = new RssManager();
			feedName = selectedFeedName;
			RssList = new List<pnlItemFeed>();
			
			if(selectedFeedName.Length > 0)
			{
				reader.Url = "/Application/feeds/"+selectedFeedName+".xml";
			}
	        reader.GetFeed();
            list = reader.RssItems;
			
			//feed dingen opvullen
			listSection = new ListSection("Feeds", list.Count); 
			section = new ListSectionCollection { listSection };

            // ImageBox_1
            ImageBox_1.Image = new ImageAsset("/Application/assets/back.png");

            // pnlItemsList
			pnlItemsList.ShowEmptySection = false;
            pnlItemsList.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible;
            pnlItemsList.SetListItemCreator(ListItemCreator);
			pnlItemsList.SetListItemUpdater(ListItemUpdator);
			pnlItemsList.Sections = section;
			
            // btnGoBack
            btnGoBack.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            btnGoBack.TextFont = new Font( FontAlias.System, 25, FontStyle.Regular);
			btnGoBack.TouchEventReceived += HandleBtnGoBackTouchEventReceived;

            // lblFeedTitle
            lblFeedTitle.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
            lblFeedTitle.Font = new Font( FontAlias.System, 30, FontStyle.Bold);
            lblFeedTitle.LineBreak = LineBreak.Character;

            // Scene
			pnlItemsList.UpdateItems();
            menuScene.RootWidget.AddChildLast(ImageBox_1);
            menuScene.RootWidget.AddChildLast(btnGoBack);
            menuScene.RootWidget.AddChildLast(lblFeedTitle);
			menuScene.RootWidget.AddChildLast(pnlItemsList);
            SetWidgetLayout(orientation);

            UpdateLanguage();
        }

        void HandleBtnGoBackTouchEventReceived (object sender, TouchEventArgs e)
        {
        	AppMain.callTestStartScene();
        }
		
		private ListPanelItem ListItemCreator()
        {
            return new pnlItemFeed();
        }

        public void ListItemUpdator(ListPanelItem item)
        {	
			if (item is pnlItemFeed)
            {
				RssList.Add((pnlItemFeed)item);
            }
			foreach (pnlItemFeed _item in RssList)
			{
					pnlItemFeed x = (pnlItemFeed) _item;
					x.Title = list[_item.Index].Title;
					x.Description = list[_item.Index].Description;
					x.ReadMore = constantClass.LbtnReadMore;
			}
        }

        private LayoutOrientation _currentLayoutOrientation;
        public void SetWidgetLayout(LayoutOrientation orientation)
        {
            switch (orientation)
            {
            case LayoutOrientation.Vertical:
                this.DesignWidth = 544;
                this.DesignHeight = 960;

                ImageBox_1.SetPosition(0, 0);
                ImageBox_1.SetSize(200, 200);
                ImageBox_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                ImageBox_1.Visible = true;

                pnlItemsList.SetPosition(-256, -18);
                pnlItemsList.SetSize(854, 400);
                pnlItemsList.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                pnlItemsList.Visible = true;

                btnGoBack.SetPosition(735, 15);
                btnGoBack.SetSize(214, 56);
                btnGoBack.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                btnGoBack.Visible = true;

                lblFeedTitle.SetPosition(13, 22);
                lblFeedTitle.SetSize(214, 36);
                lblFeedTitle.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                lblFeedTitle.Visible = true;

                break;

            default:
                this.DesignWidth = 960;
                this.DesignHeight = 544;

                ImageBox_1.SetPosition(0, 0);
                ImageBox_1.SetSize(960, 544);
                ImageBox_1.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                ImageBox_1.Visible = true;

                pnlItemsList.SetPosition(0, 90);
                pnlItemsList.SetSize(960, 440);
                pnlItemsList.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                pnlItemsList.Visible = true;

                btnGoBack.SetPosition(735, 15);
                btnGoBack.SetSize(214, 56);
                btnGoBack.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                btnGoBack.Visible = true;

                lblFeedTitle.SetPosition(12, 10);
                lblFeedTitle.SetSize(442, 61);
                lblFeedTitle.Anchors = Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Width;
                lblFeedTitle.Visible = true;

                break;
            }
            _currentLayoutOrientation = orientation;
        }
        public void UpdateLanguage()
        {
            btnGoBack.Text = constantClass.LbtnGoBack;
            lblFeedTitle.Text = feedName;
        }
        private void onShowing(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                {
                }
                break;

                default:
                {
                }
                break;
            }
        }
        private void onShown(object sender, EventArgs e)
        {
            switch (_currentLayoutOrientation)
            {
                case LayoutOrientation.Vertical:
                {
                }
                break;

                default:
                {
                }
                break;
            }
        }
    }
}

 

Please use plain text.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。