[Dev] Alert Box in Tizen

신현주 hyunjushin at samsung.com
Mon Dec 14 03:02:59 UTC 2020


Hi,


Tizen .Net API(NUI) provides TextPageUtil class to display very long text.
Please refer to the guide.

-------------------------------------------------------------------------
 

1. Pass TextLabel and String as arguments to SetText(TextLabel label, string text) of TextPageUtil.

 - Paging is doing based on the property set in TextLabel.

 - Get total page counts as return value.

 

2. GetText(int pageNum) of TextPageUtil

 - If user input a page number, text corresponding to the page is returned.


3. This is sample source.


using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Utility;
using Tizen.NUI.Components;
using Tizen.NUI.Events;

using System;
using System.IO;
using Tizen.System;

namespace Tizen.NUI.Samples
{
    public class TextPageSample : IExample
    {
        private View root;

        private TextLabel label;
        private int pageCount;
        private int currentPageNum;
        private TextPageUtil util;

        public string LoadTerms()
        {
            string terms = null;
            var filename = "res/pl_PL.txt";

            try {
                terms = File.ReadAllText(filename);
            } catch (Exception e) {
                Tizen.Log.Debug("oobe", $"Unable to load terms: {e.Message}");
                return null;
            }
            return terms;
        }


        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            label = new TextLabel();
            label.Size = new Size(300, 500);
            label.PointSize = 11.0f;
            label.MultiLine = true;

            util = new TextPageUtil();
            pageCount = util.SetText( label, LoadTerms() );
            Tizen.Log.Error("NUI", $"pageCount: {pageCount}\n");
            currentPageNum = 1;
            label.Text = util.GetText(currentPageNum);
            window.Add(label);

 

            Button prev = new Button();
            prev.Position = new Position(10, 550);
            prev.TextLabel.Text = "Prev";
            prev.Size = new Size(258, 58);
            prev.Clicked += OnPushPrevButtonClicked;
            window.Add(prev);

 

            Button next = new Button();
            next.Position = new Position(220, 550);
            next.TextLabel.Text = "Next";
            next.Size = new Size(258, 50);
            next.Clicked += OnPushNextButtonClicked;
            window.Add(next);

        }

        private void OnPushPrevButtonClicked(object sender, global::System.EventArgs args)
        {
            if(currentPageNum > 1)
            {
                label.Text = util.GetText(--currentPageNum);
            }

        }

        private void OnPushNextButtonClicked(object sender, global::System.EventArgs args)
        {
            if(currentPageNum < pageCount)
            {
                label.Text = util.GetText(++currentPageNum);
            }

        }

        public void Deactivate()
        {
            if (root != null)
            {
                NUIApplication.GetDefaultWindow().Remove(root);
                root.Dispose();
            }
        }
    }
}
 

 
BRs,
HyunJu
 
--------- Original Message ---------
Sender : Ugur Basural <ugur at vizitel.com.tr>
Date : 2020-12-11 23:10 (GMT+9)
Title : [Dev] Alert Box in Tizen
 
Hello again. I am trying to display some long information in a dialog so I wonder if it is possible to display such a big content by utilizing from Tizen APIs. Is there any way to achieve this aim by Tizen TV APIs? Nice Regards,


_______________________________________________
Dev mailing list
Dev at lists.tizen.org
https://protect2.fireeye.com/v1/url?k=24096bd1-7b9252c9-2408e09e-0cc47a314e9a-9f6169e53be1d057&q=1&e=5ee9f2c9-0869-4b0d-a509-a621ed8666e5&u=https%3A%2F%2Flists.tizen.org%2Flistinfo%2Fdev
 


More information about the Dev mailing list