disabling mouse scroll in combobox [c++ .net]

how do I disable the mouse wheel scrolling when inside a combo box?

Page 1 of 1

1 Replies - 5092 Views - Last Post: 19 December 2009 - 02:34 PM Rate Topic: -----

#1 corndog   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 04-December 09

disabling mouse scroll in combobox [c++ .net]

Post icon  Posted 19 December 2009 - 01:45 PM

I have a combo box that works great. However, I found a glitch that if the mouse wheel is hit it will throw everything into the rich text box I built. So I'm trying to disable mouse scrolling in a combo box. Thanks for any help in advance

private: System::Void part_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
				 
		   if (part->Text == "AC Adapter"){
			   this->technote->Text= "S/N: " + this->SERIAL->Text +"\nP/N:\nSPARE:\nOUTPUT:\nPRONGS:\n-----------------------------------\n" + this->technote->Text;
			   this->technote->Text= "M/N: " + this->MODEL->Text +"\n" + this->technote->Text;
			   this->technote->Text= "****AC ADAPTER****\n" + this->technote->Text;}
		   else if (part->Text == "Battery"){
			   this->technote->Text= "S/N: " + this->SERIAL->Text +"\nP/N:\nCell Size:\n-----------------------------------\n" + this->technote->Text;
			   this->technote->Text= "M/N: " + this->MODEL->Text +"\n" + this->technote->Text;
			   this->technote->Text= "****BATTERY****\n" + this->technote->Text;}
		   else if (part->Text == "Wired Keyboard"){
			   this->technote->Text= "S/N: " + this->SERIAL->Text +"\nP/N:\nPort:\nGeneric Y/N:\n-----------------------------------\n" + this->technote->Text;
			   this->technote->Text= "M/N: " + this->MODEL->Text +"\n" + this->technote->Text;
			   this->technote->Text= "****WIRED KEYBOARD****\n" + this->technote->Text;}
		   else if(part->Text == "Wired Mouse"){
			   this->technote->Text= "S/N: " + this->SERIAL->Text +"\nP/N:\nPort:\nGeneric Y/N:\nOptical or Ball:\n-----------------------------------\n" + this->technote->Text;
			   this->technote->Text= "M/N: " + this->MODEL->Text +"\n" + this->technote->Text;
			   this->technote->Text= "****WIRED MOUSE****\n" + this->technote->Text;}
		   else if(part->Text == "Wireless Set"){
			   this->technote->Text= "S/N: " + this->SERIAL->Text +"\nKeyboard P/N:\nMouse P/N:\nGeneric Y/N:\n-----------------------------------\n" + this->technote->Text;
			   this->technote->Text= "M/N: " + this->MODEL->Text +"\n" + this->technote->Text;
			   this->technote->Text= "****WIRELESS SET****\n" + this->technote->Text;}
		   


Is This A Good Question/Topic? 0
  • +

Replies To: disabling mouse scroll in combobox [c++ .net]

#2 debjit625   User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 452
  • Joined: 06-September 08

Re: disabling mouse scroll in combobox [c++ .net]

Posted 19 December 2009 - 02:34 PM

its not the best way to do it but right now i dont rem.. the stuff as its a C++ .Net ,any way a simple way.
First create two variable
1)"bool status" that will check if the dropdown list event has occured or not if yes it will become true and when the dropdown list is closed it will be false.
Now the second variable its a "int index" that stores the current index of the combo when the dropdown list closed event occures.
At last we will be checking the status if the index is changed if the status is false then the index will be restored from the index variable.
The code will be like this for example
//Our variables 
bool status; //Initialized as false
int index;   // Initialized as 0


Now in comboBox_DropDown Event it will be
status = true;//When the list is shown so that we can change the index


Now in comboBox_DropDownClosed Event it will be something
status = false; 
index = this->comboBox->SelectedIndex;


Now in comboBox_SelectedIndexChanged Event it will be
if(!status)
this->comboBox->SelectedIndex = index;



Try to find some other way to do this stuff

Good Luck

This post has been edited by debjit625: 19 December 2009 - 02:40 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1