0
votes

I have one GUI (GUI1) with Button (Btn1). When I click the Btn1 a second window with plot (GUI2) appers and GUI1 becomes inactive (GUI2.fig and GUI.m are saved to disk). How to make both windows active?

I've tride something like this but it did not work:

InterfaceObj=findobj(fig,'Enable','on'); % fig = gcf;
set(InterfaceObj,'Enable','on');

GUI2 is invoked as follows:

h = GUI2;

Thanks for the answers!

My code: function visual_Callback(hObject, eventdata, handles) %Btn1 % hObject handle to visual (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

PDB_=getappdata(gcf,'PDB_');
file_=getappdata(gcf,'file_');
set(handles.PDB_list,'String', PDB_ );
SelectedItem = get(handles.PDB_list,'Value');
setappdata(gcf,'SelectedItem',SelectedItem);

fig = gcf;


h = GUI2; % GUI2.fig and .m file

visual(file_(SelectedItem,:)); %visual() is the function that generates my graph

InterfaceObj=findobj(fig,'Enable','on');
set(InterfaceObj,'Enable','on');


end
1
What do you mean "active"? This is a limitation of your operating system such that two windows can't be the active window at once.Suever
When i try to click on GUI1 its blocked. There is some way to bypass this Windows 8 limitation?destrudos
What do you mean that it's "blocked"? Any graphics updates should still occur and you can still click on it to refocus it.Suever
When i try to click on GUI1 I hear the Windows error sound and GUI1 does not come to the "First plan" (GUI2 is still on top) and I can not operate on GUI1.destrudos
it is not the limitation from your windows, your code opens a gui from another gui and waits for response from that gui so the first gui will be blocked.Hadi

1 Answers

0
votes

I've done it! I put the:

h = GUI2;

Inside the function:

mainWindow_OpeningFcn(hObject, eventdata, handles, varargin)
...
guidata(hObject, handles);
h = GUI2;
end

This initialized GUI2 with GUI1 startup. Thank You very much!