TBS_TOOLTIPS not working correctly in debug builds
Borland's Object Windows Library for the modern age
Brought to you by:
jogybl,
sebas_ledesma
Hi Jogy, as stated in the discussion, I propose that we remove the modification of the tooltip text and instead generate a diagnostic message in debug builds, hence causing less user confusion. Debugging should not cause changes in program behaviour.
Perhaps using WARNX on a higher trace level is appropriate in this case, as not to flood the diagnostics with these messages by default.
Proposed code change:
Note that I made some corrections in the code comment as well.
By the way, consider the logic in the following line:
It seems this test means to ensure that the command target is encapsulated by OWL. That makes sense, since non-OWL objects do not process WM_COMMAND_ENABLE messages anyway. However, GetParentH returns the parent of the window handle (Windows element), which may not correspond to the parent of the TWindow. So to be more precise, it seems the code should be written as follows:
Which then allows the following simplification:
Does that make sense?
Last edit: Vidar Hasfjord 2019-04-15
There should not be cases in which the parent TWindow handle differs from the parent window handle as managed by Windows - check for example the code in TWindow::SetParent that should ensure both are in sync.
Still, there are very few places where GetParentH() is used, so in this case it is better not use it, and the code looks better.
Let me know if you approve and want me to commit the change.
Yes, looks good, go ahead. Will you also make the change in 6.44 branch?
I vaguely recall having run into a situation where they did not exacly correlate. If I remember correctly, the handle of the TWindow::Parent was still an ancestor of the window in question, but not the immediate parent. Since then I have been suspicious of window parenthood. :-)
Edit: The code in TWindow::SetParent does seem to force a correlation by calling ::SetParent, so maybe I have been mistaken in my understanding. I've edited this post and removed previous comments as not to create confusion.
Ok! I will merge the fix into 6.44 also.
Last edit: Vidar Hasfjord 2019-04-15
This issue was fixed as proposed in [r4553]. The fix was merged into Owlet [r4554] and 6.44 [r4555].
Note that a similar change was made in Owlet in [r2369]. However, that revision generates a OWL_TRACEX message rather than a OWL_WARNX message. The code has now been modified to use the latter, bringing the code in line with the trunk.
Related
Commit: [r2369]
Commit: [r4553]
Commit: [r4554]
Commit: [r4555]
Diff: