Oh... that I *did* figure would work, because you create the columns
and items ahead of time.  What I was asking was whether the control
had enough magic in it to let you do the population loops without
first manually calling NewColumn and NewItem for each column and row.

But of course, even if the control (or its WE wrapper) contains enough
magic to pull that off, you'd still have to do the headers specially,
since it's Header and not Text you're populating there anyway.

On Tue, Nov 03, 2009 at 03:11:12PM -0500, Aaron Smith wrote:
I used the Hotspot XML for testing, because it has a listview. So I 
popped it up through Immed with:

dlg "t:\hotspot\hotspot.xml", "hotspotsDialog"

I then made a copy of the control:

set w  = mouse.window.control

Then I nuked all the columns:

w.columns(1).delete (I did this several times until all the columns were 
removed).

Then I created a new column:

Set c = w.newcolumn

Added it's text:

c.header = "Blah1"

Inserted it:

c.insert 0

Then set its width to autosize:

c.width = -2

I repeated those last few steps until I had columns Blah1 to Blah4.

Then I added several new list items:

set i = w.newitem
i.text = "Something"
i.insert 99

I repeated that about six times. That gave me several listview items, 
all with the text "something."

Then came the fun part. x represents column headers. y represents 
listview items.

for x = 0 to 3 : for y = 1 to 6 : w.text(y, x) = "r" & y & "c" & x + 1 : 
next : next

That populated every listview item in every column with the RyCx 
coordinates, like:

Blah1 Blah2 Blah3 Blah4
r1c1  r1c2  r1c3  r1c4
r2c1  r2c2  r2c3  r2c4
r3c1  r3c2  r3c3  r3c4
r4c1  r4c2  r4c3  r4c4
r5c1  r5c2  r5c3  r5c4
r6c1  r6c2  r6c3  r6c4

Aaron

On 11/3/2009 2:33 PM, Jeff Bishop wrote:
>Can  you provide a snippit of the code used in IMMED?
>
>----- Original Message ----- From: "Aaron Smith" <[email protected]>
>To: <[email protected]>
>Cc: "Doug Lee" <[email protected]>
>Sent: Tuesday, November 03, 2009 12:26 PM
>Subject: Re: Best way to do dynamic listviews in a WE dialog?
>
>
>>Well, I guess we should all prepare to be surprised. You really can
>>loop how you want to create listview items. You can add however many
>>columns you want, however many listview items you want, and then loop
>>through the items and populate them with whatever you want. We just
>>tried this using Immed and a blank listview control, and it worked
>>fine. You'll want to set the column widths to -2 so they autosize, and
>>pay special attention to the order in which you add them -- that seems
>>to make a difference. But it does work.
>>
>>Whodda thunk it?
>>
>>Aaron
>>
>>On 11/3/2009 1:54 PM, Aaron Smith wrote:
>>>Doug,
>>>
>>>As long as you specify a width (explicitly or implicitly) for the
>>>containing listview control, the control itself should take care of
>>>sizing the column widths.
>>>
>>>Also, you don't have to write your dynamic XML to a file before using
>>>it. You can pass XML data directly to the Dialog method via a string.
>>>Take a look at the simple dialogs and message box objects in the toolkit
>>>for examples.
>>>
>>>Regarding your last question, you would indeed be surprised if that
>>>worked. So would we. Each listview item is it's own entity, so you can't
>>>get there from here via your route.
>>>
>>>Aaron
>>>
>>>On 11/3/2009 11:37 AM, Doug Lee wrote:
>>>>I have occasion to create a scripted dialog containing a ListView
>>>>control which, depending on runtime circumstances, will either have no
>>>>column headers or will have an unknown number of columns with dynamic
>>>>names. By "dynamic," I mean they will change from one dialog creation
>>>>to another; they will not change while one dialog is showing.
>>>>
>>>>This scenario obviously outrules xml specification of column headers.
>>>>My basic question, though, is how dynamic is WE's code for positioning
>>>>and sizing things, and when does it run?
>>>>
>>>>Specifics:
>>>>
>>>>If I don't say in xml that there will be column headers, then I create
>>>>them at runtime, will things look out of whack on screen?
>>>>
>>>>Related: Would it be better to say in XML that there will be column
>>>>headers, then turn them off in code when necessary?
>>>>
>>>>If spacing and sizing is worked out at dialog creation time, I'm
>>>>wondering if I should pull the crazy stunt of writing out a dynamic
>>>>xml file and then using that to open the dialog. I doubt this is
>>>>necessary, but since I won't know the column count or widths in
>>>>advance, who knows...
>>>>
>>>>And one final question, though I bet I know the answer: Text items
>>>>and subitems look writeable, but I don't suppose this means I can
>>>>shortcut the normal red tape of inserting rows and columns a cell at a
>>>>time with Insert calls, and just fill listview.text(i,j) as a
>>>>two-dimensional array to populate the control? I'll be surprised if
>>>>that one works...
>>>>
>>>>
>>>
>>
>>--
>>To insure that you receive proper support, please include all past
>>correspondence (where applicable), and any relevant information
>>pertinent to your situation when submitting a problem report to the GW
>>Micro Technical Support Team.
>>
>>Aaron Smith
>>GW Micro
>>Phone: 260/489-3671
>>Fax: 260/489-2608
>>WWW: http://www.gwmicro.com
>>FTP: ftp://ftp.gwmicro.com
>>Technical Support & Web Development
>>
>

-- 
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.

Aaron Smith
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:[email protected]  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller

Reply via email to