From: Paoh on
Hi all,
I want to write a GUI program (self_print.m) with menu bar. When I click File>print, I want to print the m-file (i.e self_print.m). How can i make it happen? I don't want to use print menu from the M-file editor.( i want a similar one in my gui ). Any suggestion is much appreciated. Thanks in advance.
paoh
From: Shanmugam Kannappan on
"Paoh " <c0nv3t3r(a)gmail.com> wrote in message <i40ifs$4mk$1(a)fred.mathworks.com>...
> Hi all,
> I want to write a GUI program (self_print.m) with menu bar. When I click File>print, I want to print the m-file (i.e self_print.m). How can i make it happen? I don't want to use print menu from the M-file editor.( i want a similar one in my gui ). Any suggestion is much appreciated. Thanks in advance.
> paoh

Hi,

I assume that you just want to display the mfile contents in GUI.
You can use editbox in the gui.
Like:-
fid = fopen('untitled.m');
str = fread(fid,'*char');
set(handles.edit1,'string',str')
set(handles.edit1,'Enable','inactive','Max',10000000);
try in help for more info.
Enable property is to make it uneditable in the GUI & MAX is to set maximum numbaer of lines to accommodate.
I just tried & it works.

I hope it helps.

Shan!
From: Paoh on

> Hi,
>
> I assume that you just want to display the mfile contents in GUI.
> You can use editbox in the gui.
> Like:-
> fid = fopen('untitled.m');
> str = fread(fid,'*char');
> set(handles.edit1,'string',str')
> set(handles.edit1,'Enable','inactive','Max',10000000);
> try in help for more info.
> Enable property is to make it uneditable in the GUI & MAX is to set maximum numbaer of lines to accommodate.
> I just tried & it works.
>
> I hope it helps.
>
> Shan!



Thank you Shan!
I should be more precise in my question. I want to print mfile to a printer as a text file . (Just like print menu function in M-file editor) . print command can only print figure (as far as I know) . Anyway thanks u and waiting for further help.
Paoh