> Yup. Tricky...
> I thought you could hook the CB when the menu was shown, but I just
> tried and it looks very much as of you are right...

Even a blind hog finds an acorn from time to time :)

>
> OK, here's a nasty idea: make your own menu subclass, and (somehow I
> haven't thought through yet) hook the draw method that exposes the
> menu to trigger your file checks?

Yeah, but what to subclass?  The menu items are just structs with
no methods...

> > Using fltk 1.1.8 on XP at the moment.
>
> Hey! You are exactly the sort of guy we want/need to be trying out
> the 1.1.10 rc...

Someday.  To quote the poll, "I like stability."

> > char const* const filename = "strategy.log";
>
> const correctness does my head in. I think I'd write that as "const
> char* const" to stop the two consts cuddling up like that - but maybe
> that means something different?
>

Drifting off topic ... if you *always* put the "const" immediately
to the right of the thing that's constant, you *never* get
confused, no matter how consts there are.  I really
dislike the fact that "const blahblah" is a special case
that means exactly the same thing as "blahblah const."


>
> > void
> > Window::view_cb()
> > {
> >     int fd = open(filename, O_RDONLY);
> >     if(fd >= 0) {
> >         filename_->activate();
> >         close(fd);
> >     }
> >     else {
> >         filename_->deactivate();
> >     }
> > }
>
> I think I'd be tempted to use "access" or maybe even "stat" here, for
> fear that (on some platform) attempting to open a non-existent file
> would create it...?

Sure.  This was just a knockoff for posting quickly.
>
> My other idea was to only populate the menu with the names of the
> files found in each subdir (rather than starting with a list then
> marking each entry active/inactive) but I guess that suffers from the
> same problem about how to trigger that action...

Yup.

> Also, I guess you
> are doing something like a "Recent Files" list and you want to mark
> which ones are still present...?

Not exactly, but the file list is fixed, it's not a directory lookup.


Thanks for looking into this Ian.  It's had me stumped for days
and I must say I'm no further along.  Which is a bit odd, since
I'd have thought this would be a fairly common thing to want to do.

Best,
Stan


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to