Hiding a WINLIB3 trackbar

Discussions related to mouse, keyboard, fonts and Graphical User Interface
sbracken
Posts: 5
Joined: Tue 03 Apr 2018, 12:45

Hiding a WINLIB3 trackbar

Post by sbracken »

Hi all,

Is there a way to temporarily hide a trackbar created with the WINLIB3 library?

Unlike the other UI elements (edit boxes, check boxes and the like, created using WINLIB5) that I have added to the main window, trackbars don't seem to be affected by SYS "ShowWindow". I have spent a fair while googling and reading the MS documentation, but have drawn a blank. My solution has just been to destroy the trackbar with PROC_removetrackbar and recreate it when needed again, which strikes me as a little inelegant.

Thanks in advance for any assistance!
Simon
RichardRussell

Re: Hiding a WINLIB3 trackbar

Post by RichardRussell »

sbracken wrote: Sun 19 Apr 2020, 16:07trackbars don't seem to be affected by SYS "ShowWindow".
That's very strange, because on a quick experiment here trackbars do seem to be affected by ShowWindow (using Windows 10). I tested it by adding this line to WIDGETS.BBC (in the EXAMPLES\WINDOWS folder) immediately after the REPEAT:

Code: Select all

      IF (TIME MOD 200) < 100 THEN SYS "ShowWindow", !tb%, 0 ELSE SYS "ShowWindow", !tb%, 5
the idea being that the trackbar would alternate between being invisible for one second and visible for one second. And that's just what happens! Why it doesn't work for you I haven't the foggiest idea. :?
sbracken
Posts: 5
Joined: Tue 03 Apr 2018, 12:45

Re: Hiding a WINLIB3 trackbar

Post by sbracken »

Thanks Richard.

I hadn't spotted that the WINLIB3 functions return a pointer to the window handle, rather than the handle itself, so I was just using

Code: Select all

SYS "ShowWindow", tb%, 0
All working now.

best wishes
Simon
RichardRussell

Re: Hiding a WINLIB3 trackbar

Post by RichardRussell »

sbracken wrote: Wed 29 Apr 2020, 12:18 I hadn't spotted that the WINLIB3 functions return a pointer to the window handle, rather than the handle itself
From the main Help documentation: 'SYS "SendMessage", !tb%, TBM_SETPOS, 1, trackpos% (note the exclamation mark in !tb%)'.
sbracken
Posts: 5
Joined: Tue 03 Apr 2018, 12:45

Re: Hiding a WINLIB3 trackbar

Post by sbracken »

RichardRussell wrote: Thu 30 Apr 2020, 12:35 From the main Help documentation: 'SYS "SendMessage", !tb%, TBM_SETPOS, 1, trackpos% (note the exclamation mark in !tb%)'.
Yes, my own program does that properly, so I have no excuse for getting this wrong...

Simon