Say what? Strange combobox behavior... [modified]
-
Thanks to everyone at CodeProject for providing a fantastic resource for programmers. I am using several comboboxes to navigate through a flat file database of my own construction. Three of these comboboxes are almost identical in structure and function. When I select a record from the drop down list from two of the combo boxes (all are set in dropdown mode with identical checkboxes), the record is displayed, and the statements: pComboBox1or2->SetFocus; pComboBox1or2->SetEditSel(0,-1); pComboBox1or2->Clear(); clears the edit box of comboboxes 1 and 2 exactly as expected. However, when I use the same exact lines for combo box 3 pComboBox3->SetFocus; pComboBox3->SetEditSel(0,-1); pComboBox3->Clear(); in the same exact point in almost identical code for combobox 3, the edit box of the combobox refuses to clear. Interestingly, calling the combobox3 lines from the combobox 1 or two functions clears the combobox3 edit box - however this is not adequate as I need to clear the edit box after selecting a record. While trying to figure this problem out, I placed a 500 iteration loop around the statements for combobox1or2, and noted a flashing edit field - which ended with a blank edit field. When I tried the same thing with the troublesome combobox3, the edit field did not flash (although it took about the same amount of time for the process to finish), and the edit box did not clear. I have tried everyhting I can think of to make the code for the various boxes as similar as possible, and find it very strange that two of the three comboboxes work as expected, while the third does not. Any suggestions? Thanks in advance for your assistance. -- modified at 18:33 Wednesday 26th July, 2006
-
Thanks to everyone at CodeProject for providing a fantastic resource for programmers. I am using several comboboxes to navigate through a flat file database of my own construction. Three of these comboboxes are almost identical in structure and function. When I select a record from the drop down list from two of the combo boxes (all are set in dropdown mode with identical checkboxes), the record is displayed, and the statements: pComboBox1or2->SetFocus; pComboBox1or2->SetEditSel(0,-1); pComboBox1or2->Clear(); clears the edit box of comboboxes 1 and 2 exactly as expected. However, when I use the same exact lines for combo box 3 pComboBox3->SetFocus; pComboBox3->SetEditSel(0,-1); pComboBox3->Clear(); in the same exact point in almost identical code for combobox 3, the edit box of the combobox refuses to clear. Interestingly, calling the combobox3 lines from the combobox 1 or two functions clears the combobox3 edit box - however this is not adequate as I need to clear the edit box after selecting a record. While trying to figure this problem out, I placed a 500 iteration loop around the statements for combobox1or2, and noted a flashing edit field - which ended with a blank edit field. When I tried the same thing with the troublesome combobox3, the edit field did not flash (although it took about the same amount of time for the process to finish), and the edit box did not clear. I have tried everyhting I can think of to make the code for the various boxes as similar as possible, and find it very strange that two of the three comboboxes work as expected, while the third does not. Any suggestions? Thanks in advance for your assistance. -- modified at 18:33 Wednesday 26th July, 2006
your problem is that combox1 and 2 are ok in a same way but combo3 its not same,Right?
_**
**_
WhiteSky
-
your problem is that combox1 and 2 are ok in a same way but combo3 its not same,Right?
_**
**_
WhiteSky
Correct. All three boxes are almost completely identical in every way - except their behavior. Combo 1 and 2 behave linearly (as expected) every time I try, but combo 3 does not behave linearly much at all, especially with respect to the key behavior of leaving the edit box blank after the record selection is complete. Completely disabling the edit box, for example painting over it to hide the functinoing edit box underneath might be acceptable. I tried using the Drop List box, as a menas of achieving a secondary goal of preventing user input, but this makes the functioning bozes also fail to clear their edit boxes after record selection. It is as if combo 3 is not completely switching out of Drop List mode when I change the selector in the resource editor (visual ++ 6.0) except that combo 3 allows changing the edit box text in drop down mode while combo 2 does not allow edit of edit box (in drop list mode). A good work around would be a means to permanently hide the edit box so it didnot matter if it was not cleared and this would have the added feature of preventing user confusion/text entry in the edit box. Thanks for your reply.
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash
-
Correct. All three boxes are almost completely identical in every way - except their behavior. Combo 1 and 2 behave linearly (as expected) every time I try, but combo 3 does not behave linearly much at all, especially with respect to the key behavior of leaving the edit box blank after the record selection is complete. Completely disabling the edit box, for example painting over it to hide the functinoing edit box underneath might be acceptable. I tried using the Drop List box, as a menas of achieving a secondary goal of preventing user input, but this makes the functioning bozes also fail to clear their edit boxes after record selection. It is as if combo 3 is not completely switching out of Drop List mode when I change the selector in the resource editor (visual ++ 6.0) except that combo 3 allows changing the edit box text in drop down mode while combo 2 does not allow edit of edit box (in drop list mode). A good work around would be a means to permanently hide the edit box so it didnot matter if it was not cleared and this would have the added feature of preventing user confusion/text entry in the edit box. Thanks for your reply.
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash
Possible workaround: after trying many things such as calling the complete or partial selchange functions that did work, breaking the edit box clearing code out into a separate function etc. I appear to have found something that will work. Inserting a pComboBox3->Paste(); line like this: pComboBox3->SetFocus; pComboBox3->SetEditSel(0,-1); pComboBox3->Paste; pComboBox3->SetEditSel(0,-1); pComboBox3->Clear(); appears to clear the edit box. It may not be pretty - but, well - neither am I. Thanks to all of you who considered my problem and especially to WhiteSky who responded. Thanks again to everyone at Code Project.
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash