Page 150 - Basics of MATLAB and Beyond
P. 150

uicontrol(’Pos’,[110 280 60  19],’Style’,’text’,’String’,’Name:’);
                               uicontrol(’Pos’,[175 280 246 19],’Style’,’edit’);
                               uicontrol(’Pos’,[110 262 60  19],’Style’,’text’,...
                                        ’String’,’Address:’);
                               uicontrol(’Pos’,[175 262 246 19],’Style’,’edit’);
                               uicontrol(’Pos’,[110 243 60  19],’Style’,’text’,’String’,’Sex:’);
                               uicontrol(’Pos’,[175 243 121 19],’Style’,’radiobutton’,...
                                        ’String’,’Male’);
                               uicontrol(’Pos’,[301 243 121 19],’Style’,’radiobutton’,...
                                        ’String’,’Female’);










                               Frame
                               The frame style uicontrol is not an object that is meant to be interacted
                               with. It is a decoration. For example, in the GUI in the previous section
                               the text labels stand apart from the uicontrols they refer to because the
                               figure color is not the same as the background colour. You can get a
                               more integrated appearance by adding a frame:

                               uicontrol(’Position’,[99  231 332 77],’Style’,’frame’);
                               uicontrol(’Position’,[110 280 60  19],’Style’,’text’,...
                                        ’String’,’Name:’);
                               uicontrol(’Position’,[175 280 246 19],’Style’,’edit’);
                               uicontrol(’Position’,[110 262 60  19],’Style’,’text’,...
                                        ’String’,’Address:’);
                               uicontrol(’Position’,[175 262 246 19],’Style’,’edit’);
                               uicontrol(’Position’,[110 243 60  19],’Style’,’text’,...
                                        ’String’,’Sex:’);
                               uicontrol(’Position’,[175 243 121 19],’Style’,’radiobutton’,...
                                        ’String’,’Male’);
                               uicontrol(’Position’,[301 243 121 19],’Style’,’radiobutton’,...
                                        ’String’,’Female’);








                               You must issue the commands to draw the uicontrols over the frame
                               after you issue the frame command, otherwise the frame will obscure
                               the uicontrols. Some people like to divide their GUIs into sections using
                               frames. In this GUI are three frames:




                               c   2000 by CRC Press LLC
   145   146   147   148   149   150   151   152   153   154   155