Event for visibility (clipping)?

18 views
Skip to first unread message

Gonzalo Garramuño

unread,
May 10, 2024, 3:56:11 PMMay 10
to fltkg...@googlegroups.com
Is there a way to have an handle(FL_EVENT) for visible/invisible or a
clipping callback?  FL_SHOW/FL_HIDE seem to be called only when the
widget is actually hidden.

I am re-writing the FLU file requester and one thing I would like to do
is to start and stop the thumbnail creation only for visible files in
the Window.  That is, clipped files outside the viewport, they would
cancel their video threading requests while images still in the viewing
area would look for thumbnails.   This is needed as previewing some
files likes OpenUSD files can be expensive even in a thread.

--
Gonzalo Garramuño
ggar...@gmail.com

Albrecht Schlosser

unread,
May 10, 2024, 4:45:28 PMMay 10
to fltkg...@googlegroups.com
On 5/10/24 21:56 Gonzalo Garramuño wrote:
Is there a way to have an handle(FL_EVENT) for visible/invisible or a clipping callback?  FL_SHOW/FL_HIDE seem to be called only when the widget is actually hidden.

I'm not aware of such an event.


I am re-writing the FLU file requester and one thing I would like to do is to start and stop the thumbnail creation only for visible files in the Window.  That is, clipped files outside the viewport, they would cancel their video threading requests while images still in the viewing area would look for thumbnails.   This is needed as previewing some files likes OpenUSD files can be expensive even in a thread.

The only thing I know of which is related to what you seem to describe, would be fl_not_clipped()
https://www.fltk.org/doc-1.4/group__fl__drawings.html#ga2bd899d466196ffc26cc61542ee10539

This is intended to be used while drawing things and to skip parts of the widgets that are currently clipped. Maybe you can use it somehow, but I have no idea how that would fit your requirements. I imagine watching draw() calls and marking the items that are fl_not_clipped() to be processed, or something like that.

imm

unread,
May 12, 2024, 12:34:01 PMMay 12
to General FLTK
I don't know if this is pertinent or not, and it's not about visibility events per se, but "a long time ago" (in the sense that I can't even find the code for it now...) I made a "browser" of sorts for displaying "complex" widgets. (Though not as complex as video I imagine.)

In essence this ended up being derived from an Fl_Scroll filled with the complex widgets, then I used the scroll size and position to determine which widgets were visible and needed to be serviced (which I remember as being more difficult to get correct than I'd expected!)

That might work? Though it sounds like it's a big departure from what you already have, so probably not useful.


--
Ian
From my Fairphone FP3
   

Gonzalo Garramuño

unread,
May 13, 2024, 5:12:19 PMMay 13
to fltkg...@googlegroups.com

On 5/12/2024 1:33 PM, imm wrote:
>
> In essence this ended up being derived from an Fl_Scroll filled with
> the complex widgets, then I used the scroll size and position to
> determine which widgets were visible and needed to be serviced (which
> I remember as being more difficult to get correct than I'd expected!)
>
> That might work? Though it sounds like it's a big departure from what
> you already have, so probably not useful.

That's a good idea!!! The File Browser does have a Fl_Scroll with
complex widgets, so it could trigger the update.

If you can locate your old code (too much to ask I know), I'd buy you a
beer!!!

--
Gonzalo Garramuño
ggar...@gmail.com

Gonzalo Garramuño

unread,
May 25, 2024, 8:24:17 PMMay 25
to fltkg...@googlegroups.com


El 12/5/24 a las 13:33, imm escribió:
On Fri, 10 May 2024, 20:56 Gonzalo wrote:
Is there a way to have an handle(FL_EVENT) for visible/invisible or a
clipping callback?  FL_SHOW/FL_HIDE seem to be called only when the
widget is actually hidden.

I forgot to thank you Ian and Albrecht for your guidance.  Creating my own group widget and calling fl_not_clipped() was exactly the trick to get it working.

FLTK is great!


Albrecht Schlosser

unread,
May 26, 2024, 4:05:18 AMMay 26
to fltkg...@googlegroups.com
On 5/26/24 02:24 Gonzalo Garramuño wrote:
El 12/5/24 a las 13:33, imm escribió:
On Fri, 10 May 2024, 20:56 Gonzalo wrote:
Is there a way to have an handle(FL_EVENT) for visible/invisible or a
clipping callback?  FL_SHOW/FL_HIDE seem to be called only when the
widget is actually hidden.

I forgot to thank you Ian and Albrecht for your guidance.


Welcome.


Creating my own group widget and calling fl_not_clipped() was exactly the trick to get it working.


Thanks for the feedback, it's good to know that you found a solution.

FLTK is great!


:-)

Ian MacArthur

unread,
May 27, 2024, 7:03:37 AMMay 27
to fltk.general
On Sunday 26 May 2024 at 01:24:17 UTC+1 Gonzalo wrote:

I forgot to thank you Ian and Albrecht for your guidance.  Creating my own group widget and calling fl_not_clipped() was exactly the trick to get it working.

FLTK is great!

FWIW, I did have a look for my old code, but I couldn't actually find it.
The program of which it was a part didn't really end up working all that well, so it fell into disuse...

 
Reply all
Reply to author
Forward
0 new messages