|
I'm just using R13 now, as my employer doesn't have a later version.
At school I use R14SP3, I think, but that doesn't help me much.
I've kind of put this part of my project on the back burner for now,
though I keep making other things work so I'll probably be back to
this in another day or two, heh.
I'm curious if there is a hidden feature that Matlab uses to do this,
that we might be able to (in a rather ugly manner) hitch onto and use
for our own purposes.
Perry wrote:
>
>
> Ian,
>
> I agree it probably isn't a good way to go, but I put a post up
> myself asking if anyone knows of an 'OnFocus' callback, but no
> replies as yet. I'm curious myself now as it would be a handy
> function to have access to. I'm Just using a student version, R14
> so
> maybe later versions of Matlab have this facility.
>
> Perry
>
>>
>>
>> I've considered trying to use the WindowButtonDownFcn, but I
>> haven't
>> done any serious work on that yet. I'm actually using the
>> WindowButtonDownFcn already, but if I compare the figure that's
>> active to the one I think should be active, that would let me
> know
>> if
>> the user made a new figure the current figure.
>>
>> However, this does not take into account if they alt-tabbed
into
>> the
>> figure or clicked the title bar, etc, as you said. For my
>> purposes,
>> the above may be enough as my program requires you to click on
> the
>> axes eventually to do anything, but it's a rather silly way to
go
>> about writing a program.
>>
>> Perry wrote:
>>>
>>>
>>> Ian,
>>>
>>> I think what you need here is an 'OnFocus' function, i.e. a
>>> function
>>> that is called only when the user selcts it, i.e. the
figures
>>> becomes
>>> 'the focus'. The bad part is, I'm not sure Matlab enables
you
> to
>>> specify one. Sure you can 'get the current figure' with
gcf,
> but
>>> you
>>> still need to initiate this command when the figure becomes
> the
>>> focus.
>>>
>>> The nearest thing I can find to achieve this is to specify
a
>>> WindowButtonDownFcn callback. In this function you could
set
> some
>>> applicationdata that could be read by your control figure
as
> to
>>> which
>>> figure was last active.
>>>
>>> NOTE : This function is called when the user presses the
> mouse
>>> button
>>> in the figure. It does NOT get called if the user selects
the
>> title
>>> bar or and axis within the figure, so it's not going to
work
> 100%
>>> of
>>> the time. As I say, Matlab (I don't think) provides an
> 'OnFocus'
>>> callback option.
>>>
>>> Perry
>>>
>>> Ian Woloschin wrote:
>>>>
>>>>
>>>> Is it possible to detect when the current figure has
> changed
>>>> through
>>>> an interrupt/callback?
>>>>
>>>> I have a gui control figure that enables features (such
> as
>>> panning)
>>>> in other figures, but for simplicity, only one figure
is
>> active
>>> at
>>>> any given time. At this point, you need to go to the
> control
>>>> figure
>>>> to specify the active figure, but I'd like for the
> control
>> gui
>> to
>>>> automatically update if the current figure switches
from,
>> say,
>>>> figure
>>>> 1 to figure 2.
|