1

Background:

In my program, I have a list of commands that I am sending to a robot. Each command is numbered, and I display them in a list box. When my program finishes running each command, I want it to highlight the next line in the list box. Changing the SelectedIndex seems to give me what I want. However, I do not want the User to be able to change the SelectedIndex through mouse click.

What I have tried so far:

  • Disabling the list box doesn't work because it disables scrolling

  • WPF: Disable ListBox, but enable scrolling The solution here seems kind of a bit of a hack, and does not quite give me what I am looking for.

  • ListView - select index only programmatically Intended for C#, not very familiar with C#, so I'm not exactly sure if this solution will work if I try translating it over to vb.net. If this solution is indeed correct, could I get some guidance on how to translate this to vb.net?

I am kind of stuck at this point, it kind of seems like I should be looking for a better solution to this problem. What do you guys recommend? should I continue trying to look for a way to disable the user from changing selected index with mouse click or should I go a completely different route?

Community
  • 1
  • 1
Pressure
  • 13
  • 4
  • 1
    just use a boolean to ignore the change event when your code changes the index – Ňɏssa Pøngjǣrdenlarp Feb 19 '15 at 01:27
  • @Plutonix I'm not exactly following. can you elaborate? – Pressure Feb 19 '15 at 06:33
  • I am using WinForms. Essentially, I made a windows form application to provide a simple means to send macro commands to a robot. I implemented a sequence file reader, which takes a textfile and executes each command on the line. Here is an example: move x:300 y:-400 z:8000 move x:600 y:-1300 z:8000 move x:600 y:-1300 z:10000 Thats not exactly how the commands are written, but thats not important. Say I run this sequence of commands. This list of commands will be displayed on the ListBox. When it executes the first command, I want the first command to be highlighted, – Pressure Feb 19 '15 at 06:36
  • and when the second command gets run, i want the second command to be highlighted, and so on – Pressure Feb 19 '15 at 06:39

0 Answers0