Click to See Complete Forum and Search --> : weird problem with combobox and a timer


Green Fuze
April 9th, 2005, 09:03 PM
Hey eveyone!

I'm having this REALLY weird problem with a combobox, and I don't even know where to start and look for the solution!

I have created a clock (with a timer, of course), and a combobox with different GMTs, and by changing the combobox the GMT of the clock changes.

everything works perfectly, but with ONE WEIRD PROBLEM!
everytime "-1" or "-3" are being chosen the combobox changes itself to something else (if it is -3 it turns into -3:30, and if it is -1 it changes to -12),
but the clock does change to the right GMT, only the text in the combobox changes.
that means that the String of the combobox (m_strGMT) is still -3 (or -1), but for some reason the combobox still changes the text inside.

I immidatly suspected the timer UpdateData(FALSE) (for the clock) as the fault for that, and I was right, when I deleted these lines, it did not happen, but the clock of course does not work.

does anyone have any kind of idea how to fix this bug ???


THANKS!!!

Green Fuze
April 10th, 2005, 09:53 PM
okay, I figured it out! (after sometime...)
I solved it B-U-T, I had to change some things that I don't want to change, and there must be a way to correct it some other way

the data of my combobox looked something like this:
-12;-11;-10 .... -2;-1;0;+1 ... ;

the thing is that -12 is above -1, so when the combobox's string (m_strGMT) is
"-1" and the dialog is being updated, VC++.net looks for "-1" from top to bottom.
when it find "-12" it sees the the - and the 1 from the whole -12, and it fits its search, while ignoring the 2 (which is the difference between -1 and -12), so the combobox thinks that "-1" is "-12" and select -12 instead of -1 (which is really the m_strGMT value).

the problem is how to tell VC++.net that it should check "-1" as the *whole* string and not just a part of a string (which is the case in -12).

Thanks! :-)