Author Topic: Early WIP on v2.55  (Read 132907 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #120 on: November 07, 2018, 05:12:58 pm »
They are normally sent to the tooltip owner window proc when the tooltip is about to pop up but hasn't yet appeared on screen. The user can supply custom text for it in real time, rather than display the tooltip's string hardcoded at creation time.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #121 on: November 07, 2018, 05:26:07 pm »
Your auto-tooltip fix works well with mouse dragging. But if the thumb position has changed due to keyboard key presses and the tooltip pops up later on mouse hover, it still displays the last "dragged" value it stored when the mouse button was released.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #122 on: November 07, 2018, 05:40:23 pm »
Re. TBS_CUSTOMTIPS, the trackbar style largest value used so far is only 0x1000. FWIW we can safely #define TBS_CUSTOMTIPS 0x10000000 and never live long enough to see our custom style conflict with the official MS Windows documentation. :D
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #123 on: November 07, 2018, 05:50:59 pm »
to let it work with both mouse and keyboard, move the previous code from SetThumbLocation to GetThumbTrackLocation like this

void GetThumbTrackLocation(IN HWND hWnd, OUT long &tx, OUT long &ty) {
    RECT rc = {0}; float sIncrement = 0.0f; long imgW = 0, imgH = 0, tMin = 0, tMax = 0, tVal = 0, nRange = 0, nWidth = 0, nHeight = 0;

    skGetBitmapSize(g_BtnTrack, imgW, imgH);
    imgW = imgW / 2;
    tMin = (long) SendMessage(hWnd, TBM_GETRANGEMIN, 0, 0);
    tMax = (long) SendMessage(hWnd, TBM_GETRANGEMAX, 0, 0);
    tVal = (long) SendMessage(hWnd, TBM_GETPOS, 0, 0);
    GetClientRect(hWnd, &rc); nWidth = rc.right; nHeight = rc.bottom;
    if (TrackOrientation(hWnd) == TRACK_HORZ) {
        ty = (nHeight - imgW) / 2; if ((nHeight % 2) == 0) { ty += (imgH % 2); }
        nRange = nWidth - imgW;
        sIncrement = (float)((float)(tMax - tMin) / (float) nRange);
        if (sIncrement == 0) { tx = 0; } else { tx = (long)((float)(tVal - tMin) / (float)sIncrement); }
    } else {
        tx = (nWidth - imgW) / 2; if ((nWidth % 2) == 0) { tx += (imgW % 2); }
        nRange = nHeight - imgH;
        sIncrement = (float)(tMax - tMin) / (float)nRange;
        if (sIncrement == 0) { ty = 0; } else { ty = (long) ((float)(tVal - tMin) / (float)sIncrement); }
    }

    if (CheckWindowStyle(hWnd, TBS_TOOLTIPS)) { skSetToolTipText(hWnd, STRL(tVal)); }
}


I shall use  #define TBS_CUSTOMTIPS 0x10000000, and offer a new API much easier to deal with, than the convoluted WM_NOTIFY/TTN_NEEDTEXT
« Last Edit: November 07, 2018, 05:52:38 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #124 on: November 07, 2018, 07:34:45 pm »
Mike

The new API can be used on the fly.
skSetCustomTipText(GetDlgItem(gP.hMain, IDC_BRIGHT_CONTROL), L"my custom tip");
to use altogether with the new
#define TBS_CUSTOMTIPS 0x10000000
is ready to test.

See the attachment (and make a backup copy first!!!)

Look at the comments // 2018-11-07 for the changes i have done.

Of course you will have to add the new constant and the declaration at the end of OR WinLIFT.h as well.
« Last Edit: November 07, 2018, 10:19:19 pm by Michael Lobko-Lobanovsky »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #125 on: November 07, 2018, 11:24:22 pm »
Patrice,

Let's do it one step at a time. TBS_TOOLTIPS comes first, and when we fix it then we'll proceed to TBS_CUSTOMTIPS.

Your moving skSetToolTipText(hWnd, STRL(tVal)); from SetThumbLocation() over to GetThumbTrackLocation() alone in order to sync mouse dragging with keyboard control did not work.

Earlier the tooltip with the current integer value used to automatically pop up when the mouse would hover on top of it, then followed the thumb changing its readings accordingly as I pressed the LMB down and dragged it, and finally faded away when I released the LMB. Everything appeared to be working exactly like in an ordinary unskinned thumbtrack control except the readings didn't update in sync with keyboard key presses (arrow keys/PgUp/PgDn/Home/End) when the tooltip was naturally out of view.

Now the tooltip doesn't appear under the mouse any more, flashes only momentarily when I press the LMB down, and then disappears almost instantly to be never seen while dragging the thumb. :(

I think skSetToolTipText(hWnd, STRL(tVal)); should've stayed where it was but more code to handle key presses and tVal updates in the tooltip should've been added to the TrackProc() callback.

Is my analysis correct, do you think?


(BTW why should the names of SetThumbLocation() and GetThumbTrackLocation() be different?)



[UPD] Patrice, skSetToolTipText(hWnd, STRL(tVal)); should be in both Set and Get thumb location procedures! Then the tooltip's automatic tVal text is in perfect sync between mouse button and keyboard key presses. 8) I think the same applies to TBS_CUSTOMTIPS. Checking...
« Last Edit: November 07, 2018, 11:58:17 pm by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #126 on: November 08, 2018, 12:01:01 am »
Quote
Is my analysis correct, do you think?
I should have been more prolix, and better explain how to use it.

BTW you can use either TBS_TOOLTIPS or TBS_CUSTOMTIPS (mutually exclusive)
for TBS_TOOLTIPS, you already know how to use it.

For TBS_CUSTOMTIPS, you must call in real time the new API skSetCustomTipText(GetDlgItem(gP.hMain, CtrlID), WCHAR_TIP_TEXT) from any part of the code.
I could enhance it, by sending also a WM_NOTIFY/TTN_NEEDTEXT message, but this is almost the same, in both case you must provide a formatted string with the value to be shown.

Still clear as mud?

GetThumbTrackLocation, must be used for keyboard interaction, while SetThumbLocation() works only with the mouse, but of course we can use the same code in both places.

And for further obscurification i also have zGetThumbLocation and zSetThumbLocation, but it is a pandora box isn't it :)
These are for the native WinLIFT skTrackbar control, rather than subclassing pre-existing controls.

Going to bed right now, Zzzz

« Last Edit: November 08, 2018, 12:21:02 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #127 on: November 08, 2018, 12:19:04 am »
No, I was smart enough to understand the usage from the very beginning. ;) I'm not that bad, you know... ;D

I just wanted to keep both functionalities but your latest mods broke TBS_TOOLTIPS -- it should have worked exactly as in bare (naked? ;) ) Windows. So I started with fixing it first.

And no, the styles are exclusive because TBS_CUSTOMTIPS overrides all TBS_TOOLTIPS automation, so they shouldn't be applied concurrently IMHO. My fixes change the branching to if/else if.

And no again, I do not see enough grounds to name the two functions differently, sorry. But of course it's your prerogative. :)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #128 on: November 08, 2018, 12:25:08 am »
Quote
so they shouldn't be applied concurrently
I though that, mutually exclusive, had the same meaning  :-[
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #129 on: November 08, 2018, 12:42:05 am »
No, not the same: TBS_TOOLTIPS with my fix is now fully automatic without user intervention. OTOH TBS_CUSTOMTIPS requires skSetToolTipText() in both WM_V/HSCROLL and WM_??? handlers in the user window callback.

Still checking TBS_CUSTOMTIPS...
« Last Edit: November 08, 2018, 01:07:52 am by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #130 on: November 08, 2018, 02:43:01 am »
BTW frankly, I do not understand why your custom control callbacks (e.g. TrackProc()) use DefWindowProcs rather than subclassing the control's original specialized procs assined to them by Windows, to handle the control-specific messages you aren't handling yourself... Is it a correct approach, do you think? ??? Or are those callbacks meant for some type of controls different from the Windows common controls?

I've never done that in my own skinning engines I developed for use in FBSL... :-\

(Still fighting with TBS_CUSTOMTIP that seems totally non-responsive to arrow key messages and such... :( )
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #131 on: November 08, 2018, 05:28:33 am »
No success nor new ideas so far.

Moreover, I've started to get random OR crashes due to memory access violation when the Ctrl toolwindow is on screen in a fancy mode and I try to exit the app. The debug mode lands randomly at various places of OR code but the cause is always the same -- heap memory corruption. A few times the debugger even pointed me to WinLIFT.dll as the offending module. :(

I'm too tired having spent the whole night at my desk. Going to zzzz now...
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #132 on: November 08, 2018, 10:07:05 am »
My trackbar control doesn't behave the same, because i want the thumb button to jump directly to the correct mouse location, rather than moving tick by tick from the old location to the new one.

For now, just rem out the latest tooltip trackbar addition, if you think they are causing havoc in the Ctrl toolwindow.

To display trackbar values, i prefer to use something like in the attached screen shot, and keep the tooltip for generic help, like for the other controls.

So far, for the Ctrl toolwindow, i would recommend to switch to unskinned mode and plain toolwindow (no Ctrl popup) until full completion, then i will take on it and create a state of the art "tunning" like interface for the final version.

And about the final version, many of the new commands, will be converted to overlay checkboxes rather than menu options, to be more easy to use.

The important point that has been fixed in WinLIFT is the menu misalignment problem, but i couldn't see how this could have an impact on the toolwindow.
 
« Last Edit: November 08, 2018, 10:22:32 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #133 on: November 08, 2018, 10:20:05 am »
Good "morning"! :D

1. So I consider TBS_TOOLTIPS fully Windows-compliant and working as expected.

2. The problem with TBS_CUSTOMTIPS still needs further investigation and that's what I'm going to continue right now.

3. The problem with random memory crashes at exit from OR that occur only if the toolwindow has already been created (i.e. the Ctrl button has been pressed at least once) will be the last to try and resolve when item 2 above has been fully fixed.

Thant's gonna be my program for today. :-\

I've read your response while typing this and I think that what you suggest would be somewhat humiliating for my intelligence. I'm sort of a d'Artagnan by my nature: I see a challenge and I attack, rather than retreat in pitiful surrender. And at any rate, there should be no faults in your frameworks otherwise there'll be no value in them when you bequeath them to your heirs and decide to pass away. :D

So I think I can spare yet one more working day trying to resolve the problems cleanly. :)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #134 on: November 08, 2018, 10:29:47 am »
TBS_CUSTOMTIPS is something new (from yesterday) and i am still experiencing with it, to see if it is of real value or not, and if the new style is not causing havoc in Windows itself :o

Added:
I could turn it into property rather than adding a new Windows style, that is a MS prerogative.

« Last Edit: November 08, 2018, 10:35:55 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)