PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: WinFBE 2.0.0 - ListView Question  (Read 588 times)

SeaVipe

  • Senior Member
  • ***
  • Posts: 277
  • Windows 10
WinFBE 2.0.0 - ListView Question
« on: December 09, 2019, 12:14:24 PM »

Hi Paul,
Does the ListView control allow updates to the contents of an item or subitem? I know that direct edit is not yet supported so I edit the contents of a populated ListView in a separate form. Any attempts to write code that updates the control result in a compiler error 7. Expecting ')'.

Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8974
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 2.0.0 - ListView Question
« Reply #1 on: December 09, 2019, 02:42:34 PM »

This should work although I have noticed that I did not build a refresh into the Text property, so after assigning your text you should do something like this:

   frmMain.ListView1.Item(3).Text = "New Text"
   frmMain.ListView1.Item(3).SubItem(1).Text = "New SubItem Text"
   frmMain.ListView1.Refresh

I will add the Refresh to the property so after the next update you won't have to manually do the Refresh.
Not sure why you're seeing a compiler error. Can you show me a code snippet of how you are updating the cell's text?
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8974
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 2.0.0 - ListView Question
« Reply #2 on: December 09, 2019, 03:28:09 PM »

Hi Paul,
Does the ListView control allow updates to the contents of an item or subitem? I know that direct edit is not yet supported so I edit the contents of a populated ListView in a separate form. Any attempts to write code that updates the control result in a compiler error 7. Expecting ')'.



Maybe you are doing SubItems(1) instead of SubItem(1) to reference a cell? That would throw the compiler error.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

  • Senior Member
  • ***
  • Posts: 277
  • Windows 10
Re: WinFBE 2.0.0 - ListView Question
« Reply #3 on: December 09, 2019, 03:58:11 PM »

Hi Paul, Yes! Thanks. SubItems was the problem. But I had been switching back and forth between SubItem and SubItems and still getting the same error. Solved with a reboot. Also, REFRESH is working.
Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

SeaVipe

  • Senior Member
  • ***
  • Posts: 277
  • Windows 10
Re: WinFBE 2.0.0 - ListView Question
« Reply #4 on: December 09, 2019, 07:29:49 PM »

Hi Paul, what are the criteria for displaying characters in a ListView? If I exceed the width of the SubItem the end of the line displays an ellipse. If the line contains far too much data then the entire line is just a few ascii chrs.
Problem solved. I'll just put enough info to force the overflow ellipses to appear on the end of the SubItem.
« Last Edit: December 09, 2019, 08:53:19 PM by SeaVipe »
Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

raymw

  • Senior Member
  • ***
  • Posts: 376
Re: WinFBE 2.0.0 - ListView Question
« Reply #5 on: December 10, 2019, 06:28:15 PM »

The image below is from my listview testing. The left hand column is a single listview of the whole file, and the right-hand listview is the result of parsing the file, about 100 lines at a time, as needed. This saves considerable time compared to parsing the whole file in one hit for larger files. Now, I can select a line in the G-code (lh) column, and I would like the rh list view to align to that. Currently it starts with that selected line at the top of the rh list view. I want to keep the whole file as in lh column, so that I can quickly scroll around the whole file. I will also want it to work the other way around, i.e. select a row in the rh view, and align the gcode view to that. Selections will be visually, e.g. by scrolling and clicking, or by entering a line number, which may be well beyond the displayed area. Thanks to Paul and Jose, the following
Code: [Select]
         ListView_EnsureVisible(formlist.fileview.hwindow  ,startline,TRUE)
   ListView_EnsureVisible(formlist.fileview.hwindow  ,posn +displaylines-1,TRUE)
   formlist.fileview.selectedindex=startline   
              formlist.fileview.refresh
almost does part of it, it ensures the selected gcode is visible, but the selected line can appear anywhere in the displayed lines. It would help if I could find something like viewport topline/viewport bottomline, to give the line numbers of the top and bottom lines of the displayed file code.  e.g, first file line number = 0, last file line number = 20000, selected line = 350, viewport topline = 345,viewport bottomline= 358, say.  Any suggestions gratefully received.
Logged

raymw

  • Senior Member
  • ***
  • Posts: 376
Re: WinFBE 2.0.0 - ListView Question
« Reply #6 on: December 12, 2019, 10:43:18 AM »

why does this crash the program? it compiles fine, I've tried many variations, but this one column list view does not want to play. A similar multi-column works fine. Something obvious I guess, but I can't see it. variables like startline, m, etc are defined (in any case, if they were undefined, there would be compiler errors)
Code: [Select]
         startline=0
           formlist.fileview.selectedindex=0
           formlist.fileview.beginupdate
            formlist.fileview.items.clear()
           
           for j as long =  0 to displaylines
           
                  formlist.fileview.item(j).subitems.add("")
                 
           next j       
           
           for j as long =0 to displaylines
                  m=j+startline
                  formlist.fileview.item(j).text= "try"
               
           next j
                    formlist.fileview.endupdate
               formlist.fileview.selectedindex=0
               formlist.fileview.refresh

Logged

SeaVipe

  • Senior Member
  • ***
  • Posts: 277
  • Windows 10
Re: WinFBE 2.0.0 - ListView Question
« Reply #7 on: December 12, 2019, 12:26:59 PM »



Hi Ray, Is the number of Items in the existing 'fileview' ListView <= to 'displaylines' ?
In my test ListView if I try to modify the .Text of a non-existent Item the program crashes. I test with ListView1.Items.Count to ensure there are enough Items to modify.

Logged
Clive Richey
There is nothing government can give you that it hasn't already taken from you in the first place. Winston Churchill

raymw

  • Senior Member
  • ***
  • Posts: 376
Re: WinFBE 2.0.0 - ListView Question
« Reply #8 on: December 12, 2019, 05:10:34 PM »

Hi Clive, thanks for your reply. The code I showed is more or less the change to the previous query of mine, in an attempt to get the two listviews in synch. (if you look carefully at the previous posted image, you can see the two scroll bar grab points? are different lengths - the shorter it is, the longer the list. list lengths, displaylines, etc.are the same values for both the multi-column list and the single column list in this version that fails. I was trying, instead of getting the selected items to line up across different length list views, to make both listviews the same length, so that at least selected items would line up. (this was just a test of the listview for inclusion in the ff converted program I've mentioned before). Compiling of that larger program takes a while, so I stripped out the bit I wanted to test. I have come to the conclusion that I was hitting similar problems that I've  had before, a few versions back of winfbe, i.e. it gives the appearance that some indeterminate errors begin to occur, if some settings are made incorrectly, and it appears that they are carried over to future compiles.

I've gone back to altering the original larger version, and the two viewlists work fine together, so for now I've left that particular  problem, and carrying on with the manual translation of the firefly code.
Logged