Page 1 of 1 1
Topic Options
#89302 - 2002-11-05 06:34 PM Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I want to be able to keep the current computer on the screen as I step through a ListView object. I was thinking I could either .SetFocus or .Selected. That does not work for me. The ListView object does not scroll down as I go through the list.

Here is a code snippet that I am concerned about.

code:
FOR EACH $Item IN $List.Items
$Item.SetFocus
NEXT

Here is the rest of the code, if you need it.
code:
FUNCTION Ping_Click()
$Form.MousePointer = 11
$Form.Enabled = 0
$Form.BeginUpdate
ResetList_Click()
$RC = $List.Columns.Add('Ping Status')
$RC = $List.Columns.Add('Ping IP')
$RC = $List.Columns.Add('Ping Name')
$RC = $List.Columns.Add('Ping Error')
FOR EACH $Column IN $List.Columns
$Column.Width = -1
$Column.Width = -2
NEXT
$Form.EndUpdate
$Form.MousePointer = 0
$Form.Enabled = 1
$List.SetFocus

FOR EACH $Item IN $List.Items
$Item.SetFocus
$RC = IsPing($Item.SubItems(0).Text)
$PingError = @error
SELECT
CASE $PingError = 0
$PingStatus = 'On'
CASE $PingError = 1
$PingStatus = 'RAS'
CASE $PingError = 2
$PingStatus = 'Off'
CASE $PingError = 3
$PingStatus = 'Gone'
CASE 1
$PingStatus = 'PROBLEM'
ENDSELECT
$Item.SubItems(1).Text = $PingStatus
$Item.SubItems(2).Text = $AddressIP
$Item.SubItems(3).Text = $AddressName
$Item.SubItems(4).Text = $IPError
NEXT
FOR EACH $Column IN $List.Columns
$Column.Width = -1
$Column.Width = -2
NEXT
$Form.EndUpdate
$Form.MousePointer = 0
$Form.Enabled = 1
$List.SetFocus
BEEP
ENDFUNCTION

I hope this makes sense.

Thanks

[ 05. November 2002, 18:40: Message edited by: krabourn ]
_________________________
Kelly

Top
#89303 - 2002-11-05 06:42 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Is this what you're after?

code:
$Item.Selected = 1


Top
#89304 - 2002-11-05 06:48 PM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
That will select the current $Item, but it does not keep the the current $Item on the screen. If the list is longer than the Height of the ListView object, you still will not see the current $Item.

I am trying to make the list scroll as I go through it.
_________________________
Kelly

Top
#89305 - 2002-11-05 07:12 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I think the only way you can do this now is to do a SendKeys() on the ListView item.

Give this a try...

code:
FOR EACH $Item IN $List.Items
$Item.SetFocus
$nul=SendKeys({right})
$RC = IsPing($Item.SubItems(0).Text)
$PingError = @error
SELECT
CASE $PingError = 0
$PingStatus = 'On'
CASE $PingError = 1
$PingStatus = 'RAS'
CASE $PingError = 2
$PingStatus = 'Off'
CASE $PingError = 3
$PingStatus = 'Gone'
CASE 1
$PingStatus = 'PROBLEM'
ENDSELECT
$Item.SubItems(1).Text = $PingStatus
$Item.SubItems(2).Text = $AddressIP
$Item.SubItems(3).Text = $AddressName
$Item.SubItems(4).Text = $IPError
NEXT


Top
#89306 - 2002-11-05 07:17 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
A $nul=SendKeys({left}) might be better. That won't scroll the horizontal bar.
Top
#89307 - 2002-11-05 07:21 PM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
That did not work. Plus, I would have to make sure that the correct window had focus.

I think I see a feature request. Some kind of ListGoto or maybe something more generic like, ListScroll .
_________________________
Kelly

Top
#89308 - 2002-11-05 07:38 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I tested this method on my CompPswdAge script. It worked...

code:
FOR EACH $Item IN $List.Items
$List.SetFocus
$Item.Selected = 1
$RC = IsPing($Item.SubItems(0).Text)
$PingError = @error
SELECT
CASE $PingError = 0
$PingStatus = 'On'
CASE $PingError = 1
$PingStatus = 'RAS'
CASE $PingError = 2
$PingStatus = 'Off'
CASE $PingError = 3
$PingStatus = 'Gone'
CASE 1
$PingStatus = 'PROBLEM'
ENDSELECT
$Item.SubItems(1).Text = $PingStatus
$Item.SubItems(2).Text = $AddressIP
$Item.SubItems(3).Text = $AddressName
$Item.SubItems(4).Text = $IPError
$List.Items.Selected = 0
NEXT

I agree on the 'Goto' suggestion, however.

[ 05. November 2002, 19:41: Message edited by: Chris S. ]

Top
#89309 - 2002-11-05 07:42 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Actually, it works better without the SendKeys(). Note, I edited my last post in case you've already snagged it.
Top
#89310 - 2002-11-05 07:54 PM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Yes, I was too fast. [Wink]
Still not scrolling. If it did scroll this is what I as looking for. Here is the $List object.

code:
$List = $Form.ListView()
$List.Left = 10
$List.Top = 10
$List.Width = $Form.ClientWidth - 20
$List.Bottom = $Form.ClientHeight - 115
$List.Sorted = 1
$List.MultiSelect = True
$List.GridLines = True
$List.View = 3
$List.FullRowSelect = True

I remarked out .MultiSelect, .View and .FullRowSelect. and it still did not work. There must be something different.

I am using
Kix 4.12 RC1
Kixforms 2.1.2.36
_________________________
Kelly

Top
#89311 - 2002-11-05 07:55 PM Re: Kixforms - Scrolling through a ListView object
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
krabourn,chris:

Man, you guys are way too fast for me. I thought this feature wouldn't be missed in the first pass of ListView [Wink] but obviously your way ahead of me.

I will implement this in the next release, I will also step up the release to this weekend (or sooner) to correct this grievous over-sight on my part. The following is some information

$ListView.InsureVisible(Index)

Ensures that the specified item is visible within the control, scrolling the contents of the control if necessary.

Index
The zero-based index of the item to scroll into view.

Remarks
You can use this method to ensure that a specific item is visible within the ListView control. When performing validation on the items in a ListView, you can call the EnsureVisible method to ensure that an item that failed validation is displayed in the ListView control to allow the user to perform changes on the item. If the item that you want to ensure is visible is located above the viewable region of the ListView control, calling the EnsureVisible method will scroll the contents of the control until it is the first item in the viewable area of the control. If the item is below the viewable region of the ListView control, calling the EnsureVisible method will scroll the contents of the ListView control until the item is the last item in the viewable area of the control.

Top
#89312 - 2002-11-05 07:59 PM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Thanks for the quick response. I just got tired of scrolling long lists when they where running. [Big Grin]
_________________________
Kelly

Top
#89313 - 2002-11-05 08:01 PM Re: Kixforms - Scrolling through a ListView object
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Thanks, Shawn.

krabourn, did you catch the '$List.Items.Selected = 0' just above the 'Next' line?

Top
#89314 - 2002-11-05 08:11 PM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
Chris:
No, I put '$Item.Selected = 0' at the end. I did try it and still no go.

Shawn:
I guess these some type of support in already.
I added '$List.InsureVisible($Item.Index)' and I get Index numbers on the command line.
_________________________
Kelly

Top
#89315 - 2002-11-05 08:26 PM Re: Kixforms - Scrolling through a ListView object
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The EnsureVisible method definitely isn't there yet. What your seeing is the Item object displaying its own Index number, which is supported. Thus your right, at the end of the perverbial day, one will be able to code this:

$ListView.InsureVisible($Item.Index)

Could even add this variation (in addition to the one above, which is standard) if it makes sense to do it:

$Item.InsureVisible

The first example asks the ListView object to make one of its items visible. The second example asks the Item object to make itself visible. Same diff really but each may usefull under certain circumstances.

[ 05. November 2002, 20:28: Message edited by: Shawn ]

Top
#89316 - 2002-11-06 02:56 AM Re: Kixforms - Scrolling through a ListView object
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
I am surprised that I did not get an error message.
_________________________
Kelly

Top
#89317 - 2002-11-06 03:05 AM Re: Kixforms - Scrolling through a ListView object
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Kixforms is very forgiving in terms of unsupported methods, props ... it basically doesn't sqwak about any bad input [Wink]

[ 06. November 2002, 03:07: Message edited by: Shawn ]

Top
#89318 - 2002-11-06 03:24 AM Re: Kixforms - Scrolling through a ListView object
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
krabourn, just sent you an email with attached script ... which proves it takes very little to amuse me. woot !
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 837 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.065 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org