Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

ListView – how to make visible added rows?

Integrated Application Platform › Forums › General › ListView – how to make visible added rows?

  • This topic has 4 replies, 2 voices, and was last updated 7 years, 10 months ago by ajith.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 26, 2015 at 4:39 am #1164
    ajith
    Participant

    Hi,

    I have a custom control in which is a ListView defined as (ListView tips:true name: ‘view’) and a Button.

    In the On_Button method, I need to calculate something and populate the ListView with those values.

    The code inside the method include:

    .view.SetColumns(#('disease', 'agent',  'modal', 'willcox)
    for i in ob
    {
       row = Object(disease: i['disease'], modal: i['modal'], willcox: i['willcox'] , agent: Query1('FoodPoison', fp_name: i['disease']).fp_type)
    .view.Addrow(row)
    }

    The rows doesn’t get added properly. All cells in a row show disease member of the consecutive objects supplied. What am I am missing?

    I tried AddColumns method to add columns one by one.I tried Ensure Visible method after adding the rows. Both did not help.

    2) A minor mistake in User Manual:
    Setcolumns(cols) is written with lower case c. It is uppercase C in the library.

    3) Not a mistake, but a deviation from convention that you usually follow (which you may be knowing)
    The Getrow and Addrow methods are named with the first letter of the second word in lowercase.

    Thanks,
    ajith

    March 26, 2015 at 9:27 am #1165
    amckinlay
    Keymaster

    I will correct the help, thanks.

    Here is an example that works for me:

    Window(Controller {
    	New()
    		{
    		.list = .FindControl('List')
    		.list.SetColumns(#(name, age))
    		}
    	Controls()
    		{
    		return ['Vert',
    			['ListView', style: LVS.REPORT],
    			#(Button Add)]
    		}
    	On_Add()
    		{
    		.list.Addrow(#(name: Bob, age: 24))
    		.list.Addrow(#(name: Sue, age: 19))
    		}
    	 })
    March 27, 2015 at 3:06 am #1166
    ajith
    Participant

    Hi Andrew,

    Though I did not understand what was wrong originally, it is working now.
    Can you please explain the difference between using [] and () and why [] was needed in some places and () in others while defining the Control() method?

    There are two more things that I want in my ListView –

    1) After adding the rows, how to sort the listView by any one column?
    2) How to allow clicking the listView header buttons to sort by that column?

    Thanks,
    ajith

    March 27, 2015 at 11:51 am #1167
    amckinlay
    Keymaster

    […] is equivalent to Record(…) in code, or to #{…} in a constant
    I use it because it is shorter
    Although you have to be careful because Record is slightly different from Object

    1) You can sort your data before you add it to the list view. e.g. data.Sort!(By(#name))
    Or if you use DragDropListViewControl (see below) you can call the SortList method.

    2) If you use DragDropListViewControl instead of ListViewControl then you can click on the header to sort. (And you can also rearrange the columns.)

    March 30, 2015 at 5:15 am #1168
    ajith
    Participant

    Andrew,

    Thanks for your help. I used the DragDropListView and things are as I wanted. There was a small problem though. I had used .list.SetColumnName(‘disease’, “Disease”) to set the header for the columns. With this line in my control, an error to the effect – the member Disease is not present was coming up. I found that the .GetHeader was returning a number and so I couldn’t discern what was wrong. Anyway, I tried adding a field definition for the object members and removed the line defining the header from my control which was successful.

    Thanks,
    ajith

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language