Thread Subject: GUI question - don't want rmappdata called, but don't want to use uiwait

Subject: GUI question - don't want rmappdata called, but don't want to use uiwait

From: G.A.M.

Date: 27 Aug, 2007 18:00:46

Message: 1 of 3

I am writing an application with multiple windows. I want
the main window to open first. Then I want the user to be
able to interact with this main window (via uicontrols). I
want plots to be drawn in this main window, etc. Sometimes
dialogs and other windows will be opened, but the main
window should always remain open. I think this is the
default behavior...

When I try to run my program, the figure's OpeningFcn is
called, initialize_gui is called, the main gui window is
created and displayed and my uicontrols work. But, rmappdata
in gui_mainfcn is immediately called and the handle to my
main window is removed at that point. When my m-files call
findobj('Tag', 'tag_my_main_window') the resulting handle is
empty. When I execute h = findobj in the workspace, my main
window and all its controls are not among the handles returned.

My code fails because it cannot obtain a handle to my main
window for plotting or anything else.

Does anyone have an idea where I'm going wrong? This is in
r2007a.

Thank you

Subject: GUI question - don't want rmappdata called, but don't want to use uiwait

From: Darik

Date: 27 Aug, 2007 18:42:03

Message: 2 of 3

I would guess that the figure's HandleVisibility is set to
'Callback' - as a quick solution you could simply set it to
'on' so callback functions for other figures are able to see it.

Subject: GUI question - don't want rmappdata called, but don't want to use uiwait

From: G.A.M.

Date: 27 Aug, 2007 19:22:20

Message: 3 of 3

Darik - thanks for your reply. You were correct about the
HandleVisibility setting. I changed it to 'on'. However,
after doing this I get the following error:

??? Error using ==> set
uipanel handle passed to 'CurrentFigure' property - valid
figure handle required

When I step through my code, I can check the validity of the
figure's handle in the workspace. I'm not sure if this is
the best debugging technique. However, what I find this way
is that the handle becomes invalid as soon as the figure's
initialization is complete.

When I click on a uicontrol in the figure, the code to
initialize is called all over again. I would have expected
the figure to be initialized once -- unless it is closed. I
would also have expected the figure's handle to remain valid
unless the figure is closed or deleted.

I have no idea why the figure's handle becomes invalid at
the conclusion of initialization. Thanks.

FYI, I posted a related question here:
http://www.mathworks.cn/matlabcentral/newsreader/view_thread/155216


"Darik " <dgambleDEL@uwaterlooDEL.caDEL> wrote in message
<fav5tr$4ur$1@fred.mathworks.com>...
> I would guess that the figure's HandleVisibility is set to
> 'Callback' - as a quick solution you could simply set it to
> 'on' so callback functions for other figures are able to
see it.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui gui_mainfcn... G.A.M. 27 Aug, 2007 14:05:10
rssFeed for this Thread

Contact us at files@mathworks.com