tryashtar / nbt-studio

An up-to-date NBT viewer and editor with lots of new features
521 stars 42 forks source link

Tooltips disappearing quickly + Bulk editor column autoscaling still seems weird #22

Open annenveritas opened 3 years ago

annenveritas commented 3 years ago

From the recent commits it seems that it was intended to make tooltips stay practically for as much as they're needed, but they disappear in ≈6 seconds after showing up.

Also, in the recent v1.15 build, I've tried resizing the bulk editor with strings - it seems to behave in the same inconsistent way I have described previously.

tryashtar commented 3 years ago

Me no can reproduce :(

annenveritas commented 3 years ago

Me no can reproduce :(

Oh, hm, you mean both things? On your end, the tooltips (in the case of hovering over a multiline String tag in the tree view) don't disappear and the columns' sizes change consistently? Just in case I'm overlooking something, is the behaviour that I have described not the indended one? Could you show a couple of screenshots of how the columns scale for you in the bulk editor (while you're just resizing the window)? And by the way, I'm on Win7, though I doubt the tooltips internals are much different from Win10, so it's probably something else...

P.S. The build that I was trying's hashes are: Hash Value
CRC32 0DED02E6
SHA1 9E479123B63E36CF0A31EBF9B2030099ADB7845C
tryashtar commented 3 years ago

Tooltip: https://user-images.githubusercontent.com/26075577/124252278-066ae700-dae4-11eb-80da-34605db8b2b5.mp4

Resizing: https://user-images.githubusercontent.com/26075577/124252461-32866800-dae4-11eb-9edd-d0e069ded431.mp4

annenveritas commented 3 years ago

Tooltip: https://user-images.githubusercontent.com/26075577/124252278-066ae700-dae4-11eb-80da-34605db8b2b5.mp4

I'm not really sure why it works for you this way. After some googling I've found that on the MSDN, about the ToolTip::AutoPopDelay, it says: "The maximum time you can delay a popup is 5000 milliseconds. For longer durations, use the Show method to control the exact moment when the ToolTip is displayed". Maybe they've removed (maybe accidentally) this limitation in Win10, and that is why you're getting those results on your end, but it would be weird of them to remove it without mentioning it in their docs... I think that if you would be changing it to use the ToolTip::Show, it could look nice if it would display right over the tag's value in the tree view (when there's enough space of course, though there's probably an automatic placement correction).

Resizing: https://user-images.githubusercontent.com/26075577/124252461-32866800-dae4-11eb-9edd-d0e069ded431.mp4

Well, I've tried enabling the "Show window contents while dragging" feature in the Performance Settings of Windows so that the window would update at every point of resizing - this way, yeah, the resizing seems mostly consistent. But when the resizing doesn't happen lots of times in tiny steps, but is immediate (while holding down the LMB, you just see a bounding box, and the window updates just once you release the LMB), it doesn't seem to set the widths properly.

annenveritas commented 3 years ago

Investigating a bit on the tooltips, I have tried manually calling SendMessage() from the User32 library to check the tooltips' ToolTip::AutoPopDelay's WINAPI correlate, TTDT_AUTOPOP value - turns out, it's equal to GetDoubleClickTime() * 10 (6200 milliseconds in my case; changing the double click time through the control panel does affect that value). Also, I've tried changing that TTDT_AUTOPOP (also through SendMessage()) - the maximum possible seems to be 32767 ms, and if I try to set it any higher it gets reset to the default GetDoubleClickTime() * 10, just as it is described here, on MSDN: "The LOWORD specifies the delay time, in milliseconds. The HIWORD must be zero." Though in C# there seems to be an intention to make that allowed maximum even lower, it's supposed to be set to that GetDoubleClickTime() * 10 value (which is 5000 ms by default, but can get as low as 1000 ms or as high as 9000 ms, depending on the double click delay set in the control panel, so it's weird that they describe it as a static limit on MSDN).

So yeah, it's pretty strange that the popup delay isn't limited on your end - judging by the docs, it's not the intended WINAPI behaviour.

tryashtar commented 3 years ago

Why is windows like this

tryashtar commented 3 years ago

Would you mind giving this build a test for me? NbtStudio.zip

annenveritas commented 3 years ago

Alright, just did. The column autoscaling in the bulk editor now seems fine (thanks for fixing it), yet the tooltips still are disappearing just as quickly. (Oh, by the way, maybe you'd like to make the bulk editor's tooltips also display strings with line breaks in the multiline manner - currently, those seem to display a truncated version of the singleline one that's in the tree view.)

Here, on stackoverflow, is someone saying that the only version of ToolTip::Show() that is capable of infinite timeout is the ToolTip::Show(text, control, position) one. Though judging by MSDN, it seems that not only that one, but all of the following versions are not like the rest:

as these are said to display the tooltip modally (as opposed to the other versions, that do not), "that is, the ToolTip will be displayed until the Hide method is called, or until the parent form is minimized, hidden, or dismissed".