Jump to content
  • Advertisement
Sign in to follow this  

[.net] comboBox & TreeNode problems [C++]

This topic is 4481 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

This has been one of the reoccuring problems I've been having, namely when I set the a node in a structure of mine and later gets selected -- it doesn't always select the right value. For example If I open a new file with 2 masks :Default :Mask 1 and 4 frames Frame 0 -> Default Frame 1 -> Mask 1 Frame 2 -> Mask 1 Frame 3 -> Default I'll go through the debugger and it will find and set the right nodes
				frameInfoData->node = NULL;
				for(DWORD k = 0; k < sf.numMasks; k++){
					TreeNode* tnMask = m_mask->Nodes->Item[k];
					if(tnMask->Text->Equals((char*)fi[framesDone].maskName) == true){
						frameInfoData->node = tnMask;

So frame 0 and 3 will loop once and set their node to the first node in the list. Frame 1 and 2 will loop twice and set their value to the second node in the list. Okay, fine. (I also noticed that the nodes pointers that were set were different, even though there was only two masks.) Now I get to the selection process, so I click on the list which does this
				frameMaskCombo->DataSource = FrameMask->Nodes;
				if(fi->node == NULL || FrameMask->Nodes->Contains(fi->node) == false)
					fi->node = FrameMask->Nodes->Item[0];
				frameMaskCombo->SelectedItem = fi->node;

which sets the current node for that specific frame, but when I load the frames that were just opened. I get completely random output, mostly they all set to the default value (or the highest value in the list) It works otherwise, when I set the value using the combo box
fi->node = __try_cast<TreeNode*>(frameMaskCombo->SelectedItem);

it stays, and when I come back to the frame (clicking on the list) it saves it fine. Same with saving, it saves and loads the output fine.
LSF1ô  ô                                                                                           Default                                         Mask 1                             A   A   A   AAnimation 1                        Animation 2                        Default                           €?  €?  €?  €?  €?  €?    ÿÿÿÿ       Mask 1                            €?  €?  €?  €?  €?  €?  €?ÿÿÿÿ     €?Mask 1                             @   @  €?  €?   @   @   @   ÿ      @Default                            @   @  €?  €?   @   @    ÿÿÿÿ       

(last 4 frames have char[30] values, reading in order (Default, Mask 1, Mask 1, Default) So everything boils down to setting of the nodes in the open method. (First source box). I'm not sure why it acts up, but all I'm guessing it has something to do with Item[k] returning different pointers for the same nodes (Default, Default) (Mask 1, Mask 1) Does anyone see the problem?

Share this post

Link to post
Share on other sites
I hate to bump this, but I still can't figure this out. What would cause the combobox to find the right nodes when they are set, but not find the right (or incorrect) nodes after the file is loaded?

Share this post

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

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!