Custom ListView - ColinTreeListView *


Higher level "ListView", using extensions!

  • Update on 2019.6.5 (Version 11):

    • Added Translations (need platform supporting)
    • Fixed a Get method bug by @10MINT
    • Added ExtraButtonImage in ColinTreeListViewElement part of work done by @mkakozbeklem
    • Removed flag deprecated from all blocks
  • Update on 2018.7.27 (Version 10):

    • Added Get by @10MINT
    • Added LastLongClickedElement by @10MINT
    • Fixes label cannot click on some platforms
  • Update on 2018.3.10 (Version 9):

    • Fixed Error of Visiblility
    • Added ClearCache(path) & ClearAllCache() -- still in test, it should works
  • Update on 2018.3.4 (Version 8)

    • Fixed extraButtonEnabled not implemented
    • Added support of direct(static) functions in ColinTreeListViewElement
  • Update on 2018.2.25 (Version 7) THANK YOU @User81 FOR SPONSORING:

    • Fixed that lastClickedElement starts from 0
    • Fixed that images that cached by a same path would act wired when one of them is clicked
    • Added a extra button
    • Added property handler for every single element of the listview -> useage
  • Update on 2018.2.11 (Version 6):

    • Added properties of text height (both main- & sub-text)
  • Update on 2018.1.31 (Version 5):

    • Added icon text related properties
    • Added lastClickedElement & lastClickedIcon
  • Update on 2017.12.30 (Version 4):

    • Adapted to all platforms (ai2.appinventor.mit.edu , thunkable , etc.) There should not more NoSuchMethodError at anywhere.
  • Update on 2017.12.29 (version 3):

    • Adapted to new Appinventor (since 2017.12.27, Companion 2.45) (Fixed NoSuchMethodError)
    • Added properties related to image loading - AsyncImageLoad & CacheImage (that in a same path)
    • Added property - ScrollBottomAfterAdd

How to use

  1. Left a VerticalArrangement or a VerticalScrollArrangement, set the width and the height as you like.
    Here is the sample:

  2. Before do anything like add a element, initialize it first:
    Choose only one of the initialize method

  3. Set the list
    The "set" method required a list, and the list elements can be:

    • Single text element without icon:
      The list element here is just a Text, and it will be shown in the element
    • Single text element without icon(same with the one above):
      A sub-list with only one item is also allowed when creating a Single text element without icon.
    • Single text element with icon:
      The sub-list with two item will be proceed as a Single text element with icon.
      The first item is the icon path, when the second one is the text here.
    • Double text element with icon:
      A list with at least three item, is being recognize as a Double text elemtnt with icon. And only the very first three items will be used as the parameters here. They are: icon(path), Main-text, and Sub-text

    The three types of list element can exist when a ColinTreeListView is created

    Sample code:

    Runtime screenshot (IconMultiParams checked):

Events

  • Element events:

    • ElementClick
      whenColinTreeListView1.ElementClick elementIndex do
      • related property: LastClickedElement
        ColinTreeListView1.LastClickedElement
    • ElementLongClick
      whenColinTreeListView1.ElementLongClick elementIndex do
      • related property: LastLongClickedElement
        ColinTreeListView1.LastLongClickedElement
    • ElementTouchDown
      whenColinTreeListView1.ElementTouchDown elementIndex do
    • ElementTouchUp
      whenColinTreeListView1.ElementTouchUp elementIndex do
  • ExtraButton events:

    • ExtraButtonClick
      whenColinTreeListView1.ExtraButtonClick elementIndex do
      • related property: LastClickedExtraButton
        ColinTreeListView1.LastClickedExtraButton
    • ExtraButtonLongClick
      whenColinTreeListView1.ExtraButtonLongClick elementIndex do
    • ExtraButtonTouchDown
      whenColinTreeListView1.ExtraButtonTouchDown elementIndex do
    • ExtraButtonTouchUp
      whenColinTreeListView1.ExtraButtonTouchUp elementIndex do
  • Element icon events:

    • IconClick
      whenColinTreeListView1.IconClick elementIndex do
      • related property: LastClickedIcon
        ColinTreeListView1.LastClickedIcon
    • IconLongClick
      whenColinTreeListView1.IconLongClick elementIndex do
    • IconTouchDown
      whenColinTreeListView1.IconTouchDown elementIndex do
    • IconTouchUp
      whenColinTreeListView1.IconTouchUp elementIndex do

Methods

  • List operations:

    • AddElement
      callColinTreeListView1.AddElementelement
    • AddEmptyElement
      callColinTreeListView1.AddEmptyElement
    • Clear
      callColinTreeListView1.Clear
    • Get
      callColinTreeListView1.Get
    • GetElement
      callColinTreeListView1.GetElementelementIndex
    • Initialize
      callColinTreeListView1.InitializeverticalArrangement
    • Initialize_Scroll (using the VerticalScrollArrangement)
      callColinTreeListView1.Initialize_ScrollverticalScrollArrangement
    • RemoveElement
      callColinTreeListView1.RemoveElementelementIndex
    • Set
      callColinTreeListView1.Setlist
  • Element operations:

    • SetElement
      callColinTreeListView1.SetElementelementIndexelement
    • SetElementIcon
      callColinTreeListView1.SetElementIconelementIndexpath
    • SetElementMainText
      callColinTreeListView1.SetElementMainTextelementIndexmainText
    • SetElementSubText
      callColinTreeListView1.SetElementSubTextelementIndexsubText
    • SetElementText
      callColinTreeListView1.SetElementTextelementIndextext
  • Other operations:

    • ClearAllCache
      callColinTreeListView1.ClearAllCache
    • ClearCache
      callColinTreeListView1.ClearCachepath

Properties

ColinTreeListView provide the real-time list layout modifing through properties
And the properties are: (the order of the properties cannot be control by code, sorry for the mess here)

  • AsyncImageLoad - load image in a asynchronous way
    ColinTreeListView1.AsyncImageLoad
    setColinTreeListView1.AsyncImageLoad
  • CacheImage - cache image by file path, in order to avoid wasting time and memory
    ColinTreeListView1.CacheImage
    setColinTreeListView1.CacheImage
  • ElementHeight - Height of elements
    ColinTreeListView1.ElementHeight
    setColinTreeListView1.ElementHeight
  • ExtraButtonBgColor
    ColinTreeListView1.ExtraButtonBgColor
    setColinTreeListView1.ExtraButtonBgColor
  • ExtraButtonEnabled - default as false, if you need a extra button, please check it (set it to true).
    ColinTreeListView1.ExtraButtonEnabled
    setColinTreeListView1.ExtraButtonEnabled
  • ExtraButtonHeight
    ColinTreeListView1.ExtraButtonHeight
    setColinTreeListView1.ExtraButtonHeight
  • ExtraButtonImage
    ColinTreeListView1.ExtraButtonImage
    setColinTreeListView1.ExtraButtonImage
  • ExtraButtonPaddings
    ColinTreeListView1.ExtraButtonPaddings
    setColinTreeListView1.ExtraButtonPaddings
  • ExtraButtonShape
    ColinTreeListView1.ExtraButtonShape
    setColinTreeListView1.ExtraButtonShape
  • ExtraButtonText - I would not support seting text of extra button of each elements :P
    ColinTreeListView1.ExtraButtonText
    setColinTreeListView1.ExtraButtonText
  • ExtraButtonTextFontBold
    ColinTreeListView1.ExtraButtonTextFontBold
    setColinTreeListView1.ExtraButtonTextFontBold
  • ExtraButtonTextFontSize
    ColinTreeListView1.ExtraButtonTextFontSize
    setColinTreeListView1.ExtraButtonTextFontSize
  • ExtraButtonWidth
    ColinTreeListView1.ExtraButtonWidth
    setColinTreeListView1.ExtraButtonWidth
  • IconBgColor
    ColinTreeListView1.IconBgColor
    setColinTreeListView1.IconBgColor
  • IconHeight
    ColinTreeListView1.IconHeight
    setColinTreeListView1.IconHeight
  • IconMultiParams - if this is checked, new format (introduced since Version 5) path||iconText would be available. Value like Photoshop.png||P will be displayed as a Text P on image Photoshop.png
    ColinTreeListView1.IconMultiParams
    setColinTreeListView1.IconMultiParams
  • IconPaddings - for larger space of text displaying
    ColinTreeListView1.IconPaddings
    setColinTreeListView1.IconPaddings
  • IconShape - same as one of buttons
    ColinTreeListView1.IconShape
    setColinTreeListView1.IconShape
  • IconTextColor
    ColinTreeListView1.IconTextColor
    setColinTreeListView1.IconTextColor
  • IconTextFontBold
    ColinTreeListView1.IconTextFontBold
    setColinTreeListView1.IconTextFontBold
  • IconTextFontSize
    ColinTreeListView1.IconTextFontSize
    setColinTreeListView1.IconTextFontSize
  • IconWidth
    ColinTreeListView1.IconWidth
    setColinTreeListView1.IconWidth
  • ScrollBottomAfterAdd - Scroll to bottom after an element is added - (using delay to make sure listview has been re-rendered)
    ColinTreeListView1.ScrollBottomAfterAdd
    setColinTreeListView1.ScrollBottomAfterAdd
  • SubTextColor
    ColinTreeListView1.SubTextColor
    setColinTreeListView1.SubTextColor
  • SubTextFontBold
    ColinTreeListView1.SubTextFontBold
    setColinTreeListView1.SubTextFontBold
  • SubTextFontSize
    ColinTreeListView1.SubTextFontSize
    setColinTreeListView1.SubTextFontSize
  • SubTextHeight (-1 for auto, -2 for fill parent)
    ColinTreeListView1.SubTextHeight
    setColinTreeListView1.SubTextHeight
  • TextColor
    ColinTreeListView1.TextColor
    setColinTreeListView1.TextColor
  • TextFontBold
    ColinTreeListView1.TextFontBold
    setColinTreeListView1.TextFontBold
  • TextFontSize
    ColinTreeListView1.TextFontSize
    setColinTreeListView1.TextFontSize
  • TextHeight (-1 for auto, -2 for fill parent)
    ColinTreeListView1.TextHeight
    setColinTreeListView1.TextHeight
  • TouchDownColor - Color when element is touch down, default alpha is 136/255, about 53%
    ColinTreeListView1.TouchDownColor
    setColinTreeListView1.TouchDownColor
  • UnderlineColor - An underline is the line between two elements
    ColinTreeListView1.UnderlineColor
    setColinTreeListView1.UnderlineColor
  • UnderlineWidth
    ColinTreeListView1.UnderlineWidth
    setColinTreeListView1.UnderlineWidth
  • WidthAfterIcon
    ColinTreeListView1.WidthAfterIcon
    setColinTreeListView1.WidthAfterIcon
  • WidthBeforeExtraButton
    ColinTreeListView1.WidthBeforeExtraButton
    setColinTreeListView1.WidthBeforeExtraButton
  • WidthBeforeIcon
    ColinTreeListView1.WidthBeforeIcon
    setColinTreeListView1.WidthBeforeIcon

Attached: the color when element is touch down

ColinTreeListViewElement

This is a handler for every single element in the listView.

Note: Before use any property, please link to a element by calling LinkToElement

Properties that not exist in ListView:

  • UseGlobalProperties - default as False, if you want the properties of this element not to be refresh when the ListView properties changed, please set this to True.
    ColinTreeListViewElement1.UseGlobalProperties
    setColinTreeListViewElement1.UseGlobalProperties
  • ElementBackgroundColor
    ColinTreeListViewElement1.ElementBackgroundColor
    setColinTreeListViewElement1.ElementBackgroundColor

Download

Need more features?

results matching ""

    No results matching ""