Does anyone know how to stop an edit box from becoming invisible after the gui figure is printed? The test code below has the same problem as the larger gui. If it is run, then "File->Print" is clicked, and the figure printed (either print to actual paper, or print to pdf), the edit box becomes invisible.
Using tabs, one can edit the the contents (without being able to see it), and if the figure is printed again, the new content is there (edit box still invisible).
If the edit box is defined after the panel the edit box behaves normally. This does not work for my purposes, as the larger gui has several edit boxes before the main panel (only the first disappears). I need the tab order to start at the top edit box, before going into the panels and using uistack does not change the tab order to put the edit box before the panel. The original gui is often used several times in a row, with the figure printed between each, and the information in that first edit box does need to be updated.
Has anyone seen this problem, or have an idea how to fix it? I'm using MATLAB 7.9.0.529 (R2009b), on Windows XP Version 5.1.
function [] = TestGUI()
% TESTGUI() is an example GUI to demonstrate the disappearing edit box on
% printing the figure that was observed in one of our standard programs.
L = {'Style','edit','Units','Pixels','Position'};
S.fh = figure('Units','Pixels','Position',[500 440 300 150],...
'Name','TestGUI','Menubar','figure','Numbertitle','off',...
'Resize','off','Color',get(0,'DefaultUicontrolBackgroundColor'));
S.ed(1) = uicontrol(S.fh,L{:},[180 112 100 20],'String','');
S.panel = uipanel(S.fh,L{3:end},[20 20 260 75],'Title','Test Panel');
S.ed(2) = uicontrol(S.panel,L{:},[48 35 200 20],'String','');
S.ed(3) = uicontrol(S.panel,L{:},[48 8 200 20],'String','');
L{2} = 'text';
S.txt(1) = uicontrol(S.fh,L{:},[145 115 30 13],'String','Item:');
S.txt(2) = uicontrol(S.panel,L{:},[6 38 40 13],'String','Input 1:');
S.txt(3) = uicontrol(S.panel,L{:},[6 11 40 13],'String','Input 2:');
set(S.ed,'BackgroundColor','white');
Just as a note: a test gui of only two edit boxes also behaves normally - the issue seems to appear with the panels.
|