Some random comments on the code that has nothing to do with the bug:
The code is very readable, except for the parts where I'm not sure if
you are making up nonsense names for the variables or not. ;-)
You could probably replace all your for-loops with foreach:
for (i = 0; i < sizeof(szamlak); i++)
combo->append_text(szamlak[i]);
=>
foreach (szamlak; int i; string ch)
combo->append_text(ch);
It might look strange as a straight C-programmer at first, but it
avoids off-by-one errors in the long run.
Also, the set_line function could be replaced by this:
string set_line (sting ch)
{
return ch * 80 + "\n";
}