Roberto Lopez wrote:Until now, I've believed that the only person knowing HMG almost as much as me, was Grigory, but, appears to be that Pete is another one
Yeah! sure.. Me too, I do have almost the same opinion about him 'Pete'.
Imagine you, one of my innermost wishes is to become, some day, a minigui-adept,
like this guy -and then of course, I will have reached yours (and Grigory's)
admirable expertise about minigui!
Roberto Lopez wrote: I'm listening...
Now seriously, about textbox's trailing spaces trimming or not.
I think trim(), is a very high level functions family,dedicated to application developers to use them as they need.
Keep in mind that trim operation affects straightly the real data, for which the only one responsible is and must be the application developer.
I can't imagine why the system/programming tool developer should or might be interested to manipulate user data. His task is to create the tools by which we'll be able to handle data on an application layer.
Trimming data "under the hood", is IMHO an arbitrary and perhaps unwanted involvement by the side of system/tool developer.
And if he takes the freedom to trim the data, why not to also capitalize them, why not to transform them into f.e. UTF16, Russian or Greek (thank you very much) codepage and so on..?
"Sometimes trailing spaces create problems with SQL database", said our friend Sudip and he's right from his *specific* SQL-POV.
But arbitrarily trimmed data misleads the system to fire an Onchanged event there where there is no real data change, and this is a rather buggy behavior.
If you want a piece of data trimmed you have the trim(). Now, what if i want my data to remain unaltered? Do i have to invent an un_trim() function to put back in their places the "unasked trimmed" spaces?
I will give you an other arbitrary, silent, hidden, and beyond every expectation, *unwanted* low level data manipulation.
The culprit here is the HB_OEMTOANSI() function. This nice and really useful function receives a string value,
transcode it to ansi character set and returns the converted value back to the caller routine. So far so good, with one exception.
If you, accidentally pass to HB_OEMTOANSI() a non string var (e.g. numeric), this good function accept it without a grumble,
throw away its value, alters its type and returns back (you guess it) a null string! Not very cute behavior in my (not so humble) opinion.
I think it'd be much more gentle, informative and useful if HB_OEMTOANSI() threw an RTE, denoting this way, the wrong passed value.
An other, perhaps satisfactory, solution could be to return the value unaltered. But this cruel (and silent!) nullification is really
indescribable. The most annoying is that this HB_OEMTOANSI() 'feature' was and still is undocumented.
I have found other functions in harbour to have similar actions, it is not the place/time to expose/discus about them now and in NO CASE my
words constitute any kind of blame against respectable harbour developers. It is a technical thoughts exchange in a good-will basis.
Conclusively, i believe that, if it is not too much breaking backward compatibility, it'd be a good idea to remove this rtrim() out of the SetWindowText function, avoiding, this way, to "touch" user data. Whatever you decide to do, it is necessary a relevant documentation notice to be made.
Just my 0.02 euros (and apologies for my long message)
best regards,
---
Pete