Click here to Skip to main content
16,010,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: Channels Pin
Luc Pattyn9-Mar-08 10:18
sitebuilderLuc Pattyn9-Mar-08 10:18 
GeneralRe: Channels Pin
Christian Graus9-Mar-08 11:05
protectorChristian Graus9-Mar-08 11:05 
GeneralSplash Screen Dispose Pin
gmhanna9-Mar-08 7:14
gmhanna9-Mar-08 7:14 
GeneralRe: Splash Screen Dispose Pin
Judah Gabriel Himango9-Mar-08 11:02
sponsorJudah Gabriel Himango9-Mar-08 11:02 
GeneralRe: Splash Screen Dispose Pin
gmhanna16-Mar-08 6:36
gmhanna16-Mar-08 6:36 
QuestionOpening files [modified] Pin
nike_arh9-Mar-08 7:12
nike_arh9-Mar-08 7:12 
GeneralRe: Opening files Pin
Giorgi Dalakishvili9-Mar-08 9:29
mentorGiorgi Dalakishvili9-Mar-08 9:29 
GeneralSome questions regarding ListView fundamental behaviour Pin
eyalbi0079-Mar-08 6:55
eyalbi0079-Mar-08 6:55 
Hi all,

Whenever my ListView (let's call it ListView1) selected IDX changes, I wish to grant focus to another ListView (let's call it ListView2), but this is a bit problematic:

If I write ListView2.Focus() inside the ListView1.SelectedIndexChanged event handler, ListView1 is focused. In order to explain this behaviour, I'll mention few facts:

1. Mouse click is composed of 2 events: MouseUp and MouseDown. in each of these cases the control receives focus, if he didn't have it already.

2. whenever changing the selected line at a ListView, the event SelectedIndexChanged is called twice: once for removing the selection from the previously selected line, and once for selecting the new line.

So, the flow is as followed:

1. starting point: line 1 is selected in ListView1.
2. I'm clicking line 2 of ListView1.
3. Line 1 of ListView1 is unselected, which causes firing the event SelectedIndexChanged of ListView1. Now ListView2 receives focus.
4. Line 2 of ListView1 is unselected, which causes firing the event SelectedIndexChanged of ListView1. ListView2 already has focus.
5. Now ListView1 receives focus, since the MouseUp event (fired due to the MouseClick event).

Does anyone have a solution for focusing a control when changing a ListView selected IDX? it also bothers (due to other reasons) that the event SelectedIndexChanged is fired twice for each line selection. Verifying this behaviour can be done by using:

private void listView1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
     System.Threading.Thread.Sleep(500);<br />
     System.Media.SystemSounds.Beep.Play();<br />
}


When you'll change the selected line, 2 beeps will be heard.

Thanks and sorry for the long question!

Eyal.
GeneralRe: Some questions regarding ListView fundamental behaviour Pin
LongRange.Shooter10-Mar-08 9:22
LongRange.Shooter10-Mar-08 9:22 
QuestionRe: Some questions regarding ListView fundamental behaviour [modified] Pin
eyalbi00710-Mar-08 21:59
eyalbi00710-Mar-08 21:59 
GeneralRe: Some questions regarding ListView fundamental behaviour Pin
LongRange.Shooter11-Mar-08 16:32
LongRange.Shooter11-Mar-08 16:32 
GeneralRe: Some questions regarding ListView fundamental behaviour Pin
eyalbi00711-Mar-08 22:06
eyalbi00711-Mar-08 22:06 
QuestionDictionary Sorting ??? Pin
Jammer9-Mar-08 6:44
Jammer9-Mar-08 6:44 
AnswerRe: Dictionary Sorting ??? Pin
Professor Sharada Ulhas9-Mar-08 10:57
Professor Sharada Ulhas9-Mar-08 10:57 
GeneralRe: Dictionary Sorting ??? Pin
Jammer9-Mar-08 11:29
Jammer9-Mar-08 11:29 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:31
sponsorJudah Gabriel Himango10-Mar-08 11:31 
GeneralRe: Dictionary Sorting ??? Pin
Jammer9-Mar-08 12:46
Jammer9-Mar-08 12:46 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 7:17
sponsorJudah Gabriel Himango10-Mar-08 7:17 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 10:17
Jammer10-Mar-08 10:17 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:10
Jammer10-Mar-08 11:10 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:19
sponsorJudah Gabriel Himango10-Mar-08 11:19 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:23
Jammer10-Mar-08 11:23 
GeneralRe: Dictionary Sorting ??? Pin
Judah Gabriel Himango10-Mar-08 11:33
sponsorJudah Gabriel Himango10-Mar-08 11:33 
GeneralRe: Dictionary Sorting ??? Pin
Jammer10-Mar-08 11:46
Jammer10-Mar-08 11:46 
GeneralOOP Question Pin
MarkPhB9-Mar-08 5:19
MarkPhB9-Mar-08 5:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.