Jump to content
  • Advertisement
Sign in to follow this  
PumpkinPieman

[.net] Changing position when typing in decimal box

This topic is 4521 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure how I can approach this, what I'm trying to do is have it so the user can type in some numeric fields and it will take those values when the box is changed and update the data structures like so...
private: System::Void frameUpDown_KeyUp(System::Object * sender, System::Windows::Forms::KeyEventArgs * e) { frameUpDown_ValueChanged(sender, NULL); }

private: System::Void frameUpDown_ValueChanged(System::Object *  sender, System::EventArgs *  e)
		 {
			 System::Windows::Forms::TreeNode* sn = FrameLayout->SelectedNode;

			 // only check if these items are a frame, not an animation
			 if(sn != NULL && sn->Parent != NULL){
				 LSFW_FRAMEINFO* fi = __try_cast<LSFW_FRAMEINFO*>(sn->Tag);

				 // check each button and set the value, or request a set using dialogs
				 if(sender == frameUpDown1) fi->position[0] = (float)frameUpDown1->get_Value();
				 else if(sender == frameUpDown2) fi->position[1] = (float)frameUpDown2->get_Value();

				 else if(sender == frameUpDown3) fi->centre[0] = (float)frameUpDown3->get_Value();
				 else if(sender == frameUpDown4) fi->centre[1] = (float)frameUpDown4->get_Value();

				 else if(sender == frameUpDown5) fi->scale[0] = (float)frameUpDown5->get_Value();
				 else if(sender == frameUpDown6) fi->scale[1] = (float)frameUpDown6->get_Value();

				 else if(sender == frameUpDown7) fi->rotation = (float)frameUpDown7->get_Value();
				 else if(sender == frameUpDown8) fi->duration = (DWORD)(float)frameUpDown8->get_Value();
				 else if(sender == frameUpDown9) fi->depth = (float)frameUpDown9->get_Value();
				 else if(sender == frameColour){
					 System::Windows::Forms::ColorDialog* cd = new System::Windows::Forms::ColorDialog();
					 if(cd->ShowDialog(this) == DialogResult::OK){
						 fi->diffuse = (DWORD)cd->get_Color().ToArgb();
						 frameColour->set_BackColor(cd->get_Color());
					 }
				 }
				 else if(sender == frameMaskCombo){
					 fi->node = __try_cast<TreeNode*>(frameMaskCombo->SelectedItem);
				 }
					
			 }
		 }


However when I key is pressed and the box had a decimal place the key is entered and the position in the box is moved to the front. So typing 600 in a decimal box will result in typing 006. Anyone have any idea why this only happens to a numeric box when a decimal is used?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!