Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9227 > unrolled thread

ListView

Started byRob Smith <rasmithhalifax@gmail.com>
First post2016-04-03 07:22 -0700
Last post2016-04-04 15:15 +0200
Articles 4 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  ListView Rob Smith <rasmithhalifax@gmail.com> - 2016-04-03 07:22 -0700
    Re: ListView JohnMartens <martens@tennishulp.info> - 2016-04-03 18:03 +0200
      Re: ListView Rob Smith <rasmithhalifax@gmail.com> - 2016-04-04 03:03 -0700
        Re: ListView JohnMartens <martens@tennishulp.info> - 2016-04-04 15:15 +0200

#9227 — ListView

FromRob Smith <rasmithhalifax@gmail.com>
Date2016-04-03 07:22 -0700
SubjectListView
Message-ID<8d50ea90-468a-4289-8c1c-f78d530b707e@googlegroups.com>
I have the following coding

for nMod:=1 to Len(aBuild)
    sSymbol:=String2Symbol(aBuild[nMod][1])
    oLVC:=ListViewColumn{12,sSymbol}
    oLVC:Caption:=RTrim(aBuild[nMod][1])
    self:oDClvHaltsDown:AddColumn(oLVC)
    oLVI:=ListViewItem{} 
    // 2 blank rows
    oLVI:SetText("1",sSymbol)
    self:oDClvHaltsDown:AddItem(oLVI)
    oLVI:=ListViewItem{}
    oLVI:SetText("2",sSymbol)
    self:oDClvHaltsDown:AddItem(oLVI)
    for nSub:=2 to Len(aBuild[nMod])
        oLVI:=ListViewItem{} 
	oLVI:SetText(aBuild[nMod][nSub],sSymbol)
	self:oDClvHaltsDown:AddItem(oLVI)
    next
next

I am expecting them to go in the correct column, which they do, but after the column title to have 2 blank rows then data (actually I set the 2 blanks to 1 and 2 so I could see where they go). For the first column there are 11 blanks rows then what I expect, for the next column 22 blank rows and what I expect, then 33, 44 etc.

What am I doing wrong?

Thanks

Robert

[toc] | [next] | [standalone]


#9228

FromJohnMartens <martens@tennishulp.info>
Date2016-04-03 18:03 +0200
Message-ID<57013EB6.2030703@tennishulp.info>
In reply to#9227
Hi Robert,

Firt of all I'm a real VO guru but I hope I can help.
Defining ListView Columns is something to do once and then fill the 
content of the LV items

so something like

for dwLV := 1 to ALen(aLVColInfo)
       oLVC:=ListViewColumn{12,aLVColInfo[dwLV,1]}
       oLVC:Caption:=RTrim(aLVColInfo[dwLV,2])
       self:oDClvHaltsDown:AddColumn(oLVC)
next

for dwLW := 1 to ALen(aLVInfo)
	oLVI:=ListViewItem{}
	oLVI:SetValue(aLVInfo[dwLV,1],aLVColInfo[1,1])
	oLVI:SetValue(aLVInfo[dwLV,2],aLVColInfo[2,1])
	oLVI:SetValue(aLVInfo[dwLV,3],aLVColInfo[3,1])
	self:oDClvHaltsDown:AddItem(oLVI)
next


Does this help to clarify ?

John


Op 3-4-2016 om 16:22 schreef Rob Smith:
> I have the following coding
>
> for nMod:=1 to Len(aBuild)
>      sSymbol:=String2Symbol(aBuild[nMod][1])
>      oLVC:=ListViewColumn{12,sSymbol}
>      oLVC:Caption:=RTrim(aBuild[nMod][1])
>      self:oDClvHaltsDown:AddColumn(oLVC)
>      oLVI:=ListViewItem{}
>      // 2 blank rows
>      oLVI:SetText("1",sSymbol)
>      self:oDClvHaltsDown:AddItem(oLVI)
>      oLVI:=ListViewItem{}
>      oLVI:SetText("2",sSymbol)
>      self:oDClvHaltsDown:AddItem(oLVI)
>      for nSub:=2 to Len(aBuild[nMod])
>          oLVI:=ListViewItem{}
> 	oLVI:SetText(aBuild[nMod][nSub],sSymbol)
> 	self:oDClvHaltsDown:AddItem(oLVI)
>      next
> next
>
> I am expecting them to go in the correct column, which they do, but after the column title to have 2 blank rows then data (actually I set the 2 blanks to 1 and 2 so I could see where they go). For the first column there are 11 blanks rows then what I expect, for the next column 22 blank rows and what I expect, then 33, 44 etc.
>
> What am I doing wrong?
>
> Thanks
>
> Robert
>

[toc] | [prev] | [next] | [standalone]


#9229

FromRob Smith <rasmithhalifax@gmail.com>
Date2016-04-04 03:03 -0700
Message-ID<e6c8999c-100f-41db-beb9-475940a6fc3a@googlegroups.com>
In reply to#9228
On Sunday, 3 April 2016 17:02:50 UTC+1, JohnMartens  wrote:
> Hi Robert,
> 
> Firt of all I'm a real VO guru but I hope I can help.
> Defining ListView Columns is something to do once and then fill the 
> content of the LV items
> 
> so something like
> 
> for dwLV := 1 to ALen(aLVColInfo)
>        oLVC:=ListViewColumn{12,aLVColInfo[dwLV,1]}
>        oLVC:Caption:=RTrim(aLVColInfo[dwLV,2])
>        self:oDClvHaltsDown:AddColumn(oLVC)
> next
> 
> for dwLW := 1 to ALen(aLVInfo)
> 	oLVI:=ListViewItem{}
> 	oLVI:SetValue(aLVInfo[dwLV,1],aLVColInfo[1,1])
> 	oLVI:SetValue(aLVInfo[dwLV,2],aLVColInfo[2,1])
> 	oLVI:SetValue(aLVInfo[dwLV,3],aLVColInfo[3,1])
> 	self:oDClvHaltsDown:AddItem(oLVI)
> next
> 
> 
> Does this help to clarify ?
> 
> John
> 
> 
> Op 3-4-2016 om 16:22 schreef Rob Smith:
> > I have the following coding
> >
> > for nMod:=1 to Len(aBuild)
> >      sSymbol:=String2Symbol(aBuild[nMod][1])
> >      oLVC:=ListViewColumn{12,sSymbol}
> >      oLVC:Caption:=RTrim(aBuild[nMod][1])
> >      self:oDClvHaltsDown:AddColumn(oLVC)
> >      oLVI:=ListViewItem{}
> >      // 2 blank rows
> >      oLVI:SetText("1",sSymbol)
> >      self:oDClvHaltsDown:AddItem(oLVI)
> >      oLVI:=ListViewItem{}
> >      oLVI:SetText("2",sSymbol)
> >      self:oDClvHaltsDown:AddItem(oLVI)
> >      for nSub:=2 to Len(aBuild[nMod])
> >          oLVI:=ListViewItem{}
> > 	oLVI:SetText(aBuild[nMod][nSub],sSymbol)
> > 	self:oDClvHaltsDown:AddItem(oLVI)
> >      next
> > next
> >
> > I am expecting them to go in the correct column, which they do, but after the column title to have 2 blank rows then data (actually I set the 2 blanks to 1 and 2 so I could see where they go). For the first column there are 11 blanks rows then what I expect, for the next column 22 blank rows and what I expect, then 33, 44 etc.
> >
> > What am I doing wrong?
> >
> > Thanks
> >
> > Robert
> >

Hi John

I think I have mimicked your code

aColumns:={}
aSymbols:={}
for nMod:=1 to Len(aBuild)
    // Add Columns
    sSymbol:=String2Symbol(aBuild[nMod][1])
    AAdd(aColumns,{sSymbol,RTrim(aBuild[nMod][1]),12})
    AAdd(aSymbols,sSymbol)
next
		
for nMod:=1 to ALen(aColumns) 
    oLVC:=ListViewColumn{aColumns[nMod][3],aColumns[nMod][1]} 
    oLVC:Caption:=RTrim(aColumns[nMod][2]) 
    self:oDClvHaltsDown:AddColumn(oLVC) 
next 

for nMod:=1 to ALen(aBuild) 
    for nSub:=2 to ALen(aBuild[nMod])
       oLVI:=ListViewItem{} 
       cValue:=StrZero(nMod,4,0)+StrZero(nSub,4,0) 
       oLVI:SetValue(cValue,aColumns[nMod][1])
       cText:=aBuild[nMod][nSub]
       if Empty(cText)
       	  cText:=".."
       endif 
       oLVI:SetText(cText,aColumns[nMod][1]) 
       self:oDClvHaltsDown:AddItem(oLVI)
    next
next 

But the same problem, they appear in the correct column but progressively lower. If the text was empty I ended up with the value in the text.

[toc] | [prev] | [next] | [standalone]


#9230

FromJohnMartens <martens@tennishulp.info>
Date2016-04-04 15:15 +0200
Message-ID<ndtp6v$s6p$1@dont-email.me>
In reply to#9229
Hi Robert,

You want to add one LV Item for every "line" in ABuild ?
You should do something like this

for nMod:=1 to ALen(aBuild)
      oLVI:=ListViewItem{}
      for nSub:=2 to ALen(aBuild[nMod])
         cValue:=StrZero(nMod,4,0)+StrZero(nSub,4,0)
         oLVI:SetValue(cValue,aColumns[nMod][1])
         cText:=aBuild[nMod][nSub]
         if Empty(cText)
         	  cText:=".."
         endif
         oLVI:SetText(cText,aColumns[nMod][1])
      next
      self:oDClvHaltsDown:AddItem(oLVI)
next

So create an LV Item only once for every element in aBuild (and use it 
in the inner loop as well)

John



Op 4-4-2016 om 12:03 schreef Rob Smith:
> On Sunday, 3 April 2016 17:02:50 UTC+1, JohnMartens  wrote:
>> Hi Robert,
>>
>> Firt of all I'm a real VO guru but I hope I can help.
>> Defining ListView Columns is something to do once and then fill the
>> content of the LV items
>>
>> so something like
>>
>> for dwLV := 1 to ALen(aLVColInfo)
>>         oLVC:=ListViewColumn{12,aLVColInfo[dwLV,1]}
>>         oLVC:Caption:=RTrim(aLVColInfo[dwLV,2])
>>         self:oDClvHaltsDown:AddColumn(oLVC)
>> next
>>
>> for dwLW := 1 to ALen(aLVInfo)
>> 	oLVI:=ListViewItem{}
>> 	oLVI:SetValue(aLVInfo[dwLV,1],aLVColInfo[1,1])
>> 	oLVI:SetValue(aLVInfo[dwLV,2],aLVColInfo[2,1])
>> 	oLVI:SetValue(aLVInfo[dwLV,3],aLVColInfo[3,1])
>> 	self:oDClvHaltsDown:AddItem(oLVI)
>> next
>>
>>
>> Does this help to clarify ?
>>
>> John
>>
>>
>> Op 3-4-2016 om 16:22 schreef Rob Smith:
>>> I have the following coding
>>>
>>> for nMod:=1 to Len(aBuild)
>>>       sSymbol:=String2Symbol(aBuild[nMod][1])
>>>       oLVC:=ListViewColumn{12,sSymbol}
>>>       oLVC:Caption:=RTrim(aBuild[nMod][1])
>>>       self:oDClvHaltsDown:AddColumn(oLVC)
>>>       oLVI:=ListViewItem{}
>>>       // 2 blank rows
>>>       oLVI:SetText("1",sSymbol)
>>>       self:oDClvHaltsDown:AddItem(oLVI)
>>>       oLVI:=ListViewItem{}
>>>       oLVI:SetText("2",sSymbol)
>>>       self:oDClvHaltsDown:AddItem(oLVI)
>>>       for nSub:=2 to Len(aBuild[nMod])
>>>           oLVI:=ListViewItem{}
>>> 	oLVI:SetText(aBuild[nMod][nSub],sSymbol)
>>> 	self:oDClvHaltsDown:AddItem(oLVI)
>>>       next
>>> next
>>>
>>> I am expecting them to go in the correct column, which they do, but after the column title to have 2 blank rows then data (actually I set the 2 blanks to 1 and 2 so I could see where they go). For the first column there are 11 blanks rows then what I expect, for the next column 22 blank rows and what I expect, then 33, 44 etc.
>>>
>>> What am I doing wrong?
>>>
>>> Thanks
>>>
>>> Robert
>>>
>
> Hi John
>
> I think I have mimicked your code
>
> aColumns:={}
> aSymbols:={}
> for nMod:=1 to Len(aBuild)
>      // Add Columns
>      sSymbol:=String2Symbol(aBuild[nMod][1])
>      AAdd(aColumns,{sSymbol,RTrim(aBuild[nMod][1]),12})
>      AAdd(aSymbols,sSymbol)
> next
> 		
> for nMod:=1 to ALen(aColumns)
>      oLVC:=ListViewColumn{aColumns[nMod][3],aColumns[nMod][1]}
>      oLVC:Caption:=RTrim(aColumns[nMod][2])
>      self:oDClvHaltsDown:AddColumn(oLVC)
> next
>
> for nMod:=1 to ALen(aBuild)
>      for nSub:=2 to ALen(aBuild[nMod])
>         oLVI:=ListViewItem{}
>         cValue:=StrZero(nMod,4,0)+StrZero(nSub,4,0)
>         oLVI:SetValue(cValue,aColumns[nMod][1])
>         cText:=aBuild[nMod][nSub]
>         if Empty(cText)
>         	  cText:=".."
>         endif
>         oLVI:SetText(cText,aColumns[nMod][1])
>         self:oDClvHaltsDown:AddItem(oLVI)
>      next
> next
>
> But the same problem, they appear in the correct column but progressively lower. If the text was empty I ended up with the value in the text.
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web