Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #9230
| From | JohnMartens <martens@tennishulp.info> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: ListView |
| Date | 2016-04-04 15:15 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <ndtp6v$s6p$1@dont-email.me> (permalink) |
| References | <8d50ea90-468a-4289-8c1c-f78d530b707e@googlegroups.com> <57013EB6.2030703@tennishulp.info> <e6c8999c-100f-41db-beb9-475940a6fc3a@googlegroups.com> |
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.
>
>
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web