Thread Subject: Report generator from a GUI

Subject: Report generator from a GUI

From: Sonsoles Romero García

Date: 20 Oct, 2008 19:11:02

Message: 1 of 11

I'm using the report generator to generate a automatic report for a tool. I want to launch the report from a GUI, my problem is that once the report is generated, my GUI is closed and deleted (the report generator functionality deletes all the figures opened by Matlab).

Does anybody know how can I keep my GUI opened and get the report generated?

I've tried saving the figure but it doesn't work (the GUI has Java objects and I lose them, and by loading again all the handles are "renamed" and the GUI is not working any more)

Subject: Report generator from a GUI

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 21 Oct, 2008 08:14:27

Message: 2 of 11

Sonsoles Romero García <krokketilla@gmail.com> wrote:
> I'm using the report generator to generate a automatic report for a tool.
> I want to launch the report from a GUI, my problem is that once the report
> is generated, my GUI is closed and deleted (the report generator
> functionality deletes all the figures opened by Matlab).

That's nice of it...


>
> Does anybody know how can I keep my GUI opened and get the report generated?

Perhaps if yopu create your figure thus:

h1 = figure('handlevisibility','off');

--
Dr Tristram J. Scott
Energy Consultant

Subject: Report generator from a GUI

From: Sonsoles Romero Garc&#xED;a

Date: 21 Oct, 2008 09:23:02

Message: 3 of 11

I forgot to mention I also tried setting my GUI handlevisibility to off, and it didn't work.

Thank you very much anyway
Any others ideas?

tristram.scott@ntlworld.com (Tristram Scott) wrote in message <DbgLk.9103$Qh1.431@newsfe30.ams2>...
> Sonsoles Romero Garc?a <krokketilla@gmail.com> wrote:
> > I'm using the report generator to generate a automatic report for a tool.
> > I want to launch the report from a GUI, my problem is that once the report
> > is generated, my GUI is closed and deleted (the report generator
> > functionality deletes all the figures opened by Matlab).
>
> That's nice of it...
>
>
> >
> > Does anybody know how can I keep my GUI opened and get the report generated?
>
> Perhaps if yopu create your figure thus:
>
> h1 = figure('handlevisibility','off');
>
> --
> Dr Tristram J. Scott
> Energy Consultant

Subject: Report generator from a GUI

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 21 Oct, 2008 10:25:25

Message: 4 of 11

Sonsoles Romero García <krokketilla@gmail.com> wrote:
> I forgot to mention I also tried setting my GUI handlevisibility to off,
> and it didn't work.
>
> Thank you very much anyway
> Any others ideas?
>

File a bug report. This really isn't very good behaviour from a toolbox.

I had noticed this myself quite some time ago, but chose to ignore the gui
interface as much as possible. The difficulty, though is that the report
generator toolbox has been designed to be run via its own gui, which
doesn't lend it well to integration with another gui, or a command line
call. This is something I have raised with TMW before, but I am yet to see
any great changes.

--
Dr Tristram J. Scott
Energy Consultant

Subject: Report generator from a GUI

From: Ben

Date: 21 Oct, 2008 12:03:02

Message: 5 of 11

"Sonsoles Romero Garc?a" <krokketilla@gmail.com> wrote in message <gdil46$a66$1@fred.mathworks.com>...
> I'm using the report generator to generate a automatic report for a tool. I want to launch the report from a GUI, my problem is that once the report is generated, my GUI is closed and deleted (the report generator functionality deletes all the figures opened by Matlab).
>
> Does anybody know how can I keep my GUI opened and get the report generated?
>
> I've tried saving the figure but it doesn't work (the GUI has Java objects and I lose them, and by loading again all the handles are "renamed" and the GUI is not working any more)

I had the same thing happen to one of my GUIs and here was my work around.

I cleared out the CloseRequestFcn for the main figure of the GUI by setting it equal to empty string. (I think I did it in the opening function).

set(handle.MainGUI,'CloseRequestFcn','')

This will prevent anything from closing it. Event the "X" close button on the figure. Also it will be impossible to use delete() or close().

  So to actually close the GUI when I really wanted to I added a "Close Button" on my GUI (just a pushbutton). Make the new Close button's callback to be as follows:

set(handle.MainGUI,'CloseRequestFcn','closereq')
close(handle.MainGUI)


Hope that helps

Subject: Report generator from a GUI

From: Steven Lord

Date: 21 Oct, 2008 13:40:07

Message: 6 of 11


"Ben " <basburywvu.nospam@hotmail.com> wrote in message
news:gdkgdm$7hu$1@fred.mathworks.com...
> "Sonsoles Romero Garc?a" <krokketilla@gmail.com> wrote in message
> <gdil46$a66$1@fred.mathworks.com>...
>> I'm using the report generator to generate a automatic report for a tool.
>> I want to launch the report from a GUI, my problem is that once the
>> report is generated, my GUI is closed and deleted (the report generator
>> functionality deletes all the figures opened by Matlab).
>>
>> Does anybody know how can I keep my GUI opened and get the report
>> generated?
>>
>> I've tried saving the figure but it doesn't work (the GUI has Java
>> objects and I lose them, and by loading again all the handles are
>> "renamed" and the GUI is not working any more)
>
> I had the same thing happen to one of my GUIs and here was my work around.
>
> I cleared out the CloseRequestFcn for the main figure of the GUI by
> setting it equal to empty string. (I think I did it in the opening
> function).
>
> set(handle.MainGUI,'CloseRequestFcn','')
>
> This will prevent anything from closing it. Event the "X" close button on
> the figure. Also it will be impossible to use delete() or close().

You're half right. CLOSE will not close a figure whose CloseRequestFcn is
set to the empty string (or to something that doesn't call DELETE on the
figure handle.) DELETE will.


>> h = figure('CloseRequestFcn', 'disp(''I refuse to be closed'')');
>> close(h)
I refuse to be closed
>> close(h)
I refuse to be closed
>> % click on the X
I refuse to be closed
>> delete(h)

and the figure is gone.


> So to actually close the GUI when I really wanted to I added a "Close
> Button" on my GUI (just a pushbutton). Make the new Close button's
> callback to be as follows:
>
> set(handle.MainGUI,'CloseRequestFcn','closereq')
> close(handle.MainGUI)

Or you could have the Close button's callback be:


delete(gcbf)


--
Steve Lord
slord@mathworks.com

Subject: Report generator from a GUI

From: Sonsoles Romero Garc&#xED;a

Date: 21 Oct, 2008 14:03:03

Message: 7 of 11

Yes, Steven is right,I also had tried changing the CloseRequestFcn, hoping for something as close all was in the code, but my GUI disappeared so I think there is a delete all or something like that.

Does somebody know which function in the report generator blockset is the one in charge of close all the figures? Maybe if the code is open I will be able to change it.

Now, I'm working with the debugger searching for it.


"Steven Lord" <slord@mathworks.com> wrote in message <gdkm3n$fds$1@fred.mathworks.com>...
>
> "Ben " <basburywvu.nospam@hotmail.com> wrote in message
> news:gdkgdm$7hu$1@fred.mathworks.com...
> > "Sonsoles Romero Garc?a" <krokketilla@gmail.com> wrote in message
> > <gdil46$a66$1@fred.mathworks.com>...
> >> I'm using the report generator to generate a automatic report for a tool.
> >> I want to launch the report from a GUI, my problem is that once the
> >> report is generated, my GUI is closed and deleted (the report generator
> >> functionality deletes all the figures opened by Matlab).
> >>
> >> Does anybody know how can I keep my GUI opened and get the report
> >> generated?
> >>
> >> I've tried saving the figure but it doesn't work (the GUI has Java
> >> objects and I lose them, and by loading again all the handles are
> >> "renamed" and the GUI is not working any more)
> >
> > I had the same thing happen to one of my GUIs and here was my work around.
> >
> > I cleared out the CloseRequestFcn for the main figure of the GUI by
> > setting it equal to empty string. (I think I did it in the opening
> > function).
> >
> > set(handle.MainGUI,'CloseRequestFcn','')
> >
> > This will prevent anything from closing it. Event the "X" close button on
> > the figure. Also it will be impossible to use delete() or close().
>
> You're half right. CLOSE will not close a figure whose CloseRequestFcn is
> set to the empty string (or to something that doesn't call DELETE on the
> figure handle.) DELETE will.
>
>
> >> h = figure('CloseRequestFcn', 'disp(''I refuse to be closed'')');
> >> close(h)
> I refuse to be closed
> >> close(h)
> I refuse to be closed
> >> % click on the X
> I refuse to be closed
> >> delete(h)
>
> and the figure is gone.
>
>
> > So to actually close the GUI when I really wanted to I added a "Close
> > Button" on my GUI (just a pushbutton). Make the new Close button's
> > callback to be as follows:
> >
> > set(handle.MainGUI,'CloseRequestFcn','closereq')
> > close(handle.MainGUI)
>
> Or you could have the Close button's callback be:
>
>
> delete(gcbf)
>
>
> --
> Steve Lord
> slord@mathworks.com
>

Subject: Report generator from a GUI

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 21 Oct, 2008 15:01:28

Message: 8 of 11

Sonsoles Romero García <krokketilla@gmail.com> wrote:
> Yes, Steven is right,I also had tried changing the CloseRequestFcn,
> hoping for something as close all was in the code, but my GUI disappeared
> so I think there is a delete all or something like that.
>
> Does somebody know which function in the report generator blockset is the
> one in charge of close all the figures? Maybe if the code is open I will be
> able to change it.
>
> Now, I'm working with the debugger searching for it.
>

What if you try a variation on Steven's suggestion:

>> h = figure('DeleteFcn', 'error(''I refuse to be closed'')');

Then perhaps when the figure gets deleted you will get a call stack with the
error message.

I still say you should file a bug report. The report generator has no
business closing your figure windows.

--
Dr Tristram J. Scott
Energy Consultant

Subject: Report generator from a GUI

From: Sonsoles Romero Garc&#xED;a

Date: 21 Oct, 2008 16:34:02

Message: 9 of 11

That was a good idea, unfortunately now I get the error message and my window is close, once the DeleteFnc is called (and BeingDelete is "on") I don't know how to stop the processing of deleting it (I don't think is possible).

I have already filled a bug report, let's see if they know some work around, I really need it.

Thanks very much!


tristram.scott@ntlworld.com (Tristram Scott) wrote in message <c9mLk.44748$Zl2.1783@newsfe01.ams2>...
> Sonsoles Romero Garc?a <krokketilla@gmail.com> wrote:
> > Yes, Steven is right,I also had tried changing the CloseRequestFcn,
> > hoping for something as close all was in the code, but my GUI disappeared
> > so I think there is a delete all or something like that.
> >
> > Does somebody know which function in the report generator blockset is the
> > one in charge of close all the figures? Maybe if the code is open I will be
> > able to change it.
> >
> > Now, I'm working with the debugger searching for it.
> >
>
> What if you try a variation on Steven's suggestion:
>
> >> h = figure('DeleteFcn', 'error(''I refuse to be closed'')');
>
> Then perhaps when the figure gets deleted you will get a call stack with the
> error message.
>
> I still say you should file a bug report. The report generator has no
> business closing your figure windows.
>
> --
> Dr Tristram J. Scott
> Energy Consultant

Subject: Report generator from a GUI

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 21 Oct, 2008 19:19:45

Message: 10 of 11

Sonsoles Romero García <krokketilla@gmail.com> wrote:
> That was a good idea, unfortunately now I get the error message and my
> window is close, once the DeleteFnc is called (and BeingDelete is "on") I
> don't know how to stop the processing of deleting it (I don't think is
> possible).

When it gives the error message it should give a call stack, telling you
which functions it was executing at the time of the error. Trace these
back up to find the one that did the delete() call.

>
> I have already filled a bug report, let's see if they know some work
> around, I really need it.

Excellent.



--
Dr Tristram J. Scott
Energy Consultant

Subject: Report generator from a GUI

From: Sonsoles Romero Garc&#xED;a

Date: 22 Oct, 2008 09:02:02

Message: 11 of 11

tristram.scott@ntlworld.com (Tristram Scott) wrote in message <lXpLk.22060$FH4.10121@newsfe21.ams2>...
> Sonsoles Romero Garc?a <krokketilla@gmail.com> wrote:
> > That was a good idea, unfortunately now I get the error message and my
> > window is close, once the DeleteFnc is called (and BeingDelete is "on") I
> > don't know how to stop the processing of deleting it (I don't think is
> > possible).
>
> When it gives the error message it should give a call stack, telling you
> which functions it was executing at the time of the error. Trace these
> back up to find the one that did the delete() call.
>
Another excellent idea! Thanks!

But I only get this:
??? Error while evaluating uitoggletool OnCallback.

??? Error while evaluating figure DeleteFcn.

Caught unexpected exception of unknown type.

I have tried with the profile viewer, but it seems that most of the functions used to generate the report are .p, so my guess is the "delete" I am looking for is in one of them, so unfortunately I will not be able to change it. :-(



> >
> > I have already filled a bug report, let's see if they know some work
> > around, I really need it.
>
> Excellent.


>
>
>
> --
> Dr Tristram J. Scott
> Energy Consultant

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
report generato... Sonsoles Romero GarcĂ­a 20 Oct, 2008 15:15:07
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com