|
I had the same problem - findjobj works great!
in my code, i used x = findjobj(U.dataentry,'nomenu')
disp(get(x,'Text'))
and it worked like a champ
"MYH" <93501025@cc.ncu.edu.tw> wrote in message <f6v14p$21l3$1@news.ncu.edu.tw>...
>
> "Yair Altman" <altmanyDEL@gmailDEL.comDEL>
> ???????:ef5ce2f.2@webcrossing.raydaftYaTP...
> > MYH wrote:
> >>
> >> I also tried findjobj, but its performance was not very good.
> >
> > Use findjobj with the 'nomenu' option - this will significantly
> > improve performance
> >
> > Yair Altman
> > <http://www.ymasoftware.com>
>
> I saw some codes of findjobj for getting some ideas and decided to
> substisute java components for
> MATLAB built-in edit components.
> I was successful to achieve reading the actual length of string which
> displayed on JTextField object.
> This is my part codes (It's a CRC Calculator):
>
> function varargout = CRCCalculator(varargin)
> gui_Singleton = 1;
> gui_State = struct('gui_Name', mfilename, ...
> 'gui_Singleton', gui_Singleton, ...
> 'gui_OpeningFcn', @CRCCalculator_OpeningFcn, ...
> 'gui_OutputFcn', @CRCCalculator_OutputFcn, ...
> 'gui_LayoutFcn', [] , ...
> 'gui_Callback', []);
> if nargin && ischar(varargin{1})
> gui_State.gui_Callback = str2func(varargin{1});
> end
>
> if nargout
> [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
> else
> gui_mainfcn(gui_State, varargin{:});
> end
> % End initialization code - DO NOT EDIT
>
> global initialzated;
> % 'initialzated' variable is used to indicate whether the GUI had
> % initialzated, or not.
>
> % --- Executes just before CRCCalculator is made visible.
> function CRCCalculator_OpeningFcn(hObject, eventdata, handles, varargin)
>
> handles.output = hObject;
>
> % Update handles structure
> guidata(hObject, handles);
>
> global initialzated;
>
> % If the GUI had initialzated, we do nothing but return.
> if initialzated == 1
> return;
> end
>
> % Following codes, we will instatiate java classes for a text field
> % component. We don't use the text field components of MATLAB built-in
> % edit, because it has some bug on KeyPressFCN callback.
>
> % Import java classes.
> import javax.swing.*;
> import java.awt.*;
>
> % Set up JTextField GUI component.
> DataIn = JTextField();
> DataIn.setFont(Font('Sans Serif', Font.PLAIN, 16));
> DataIn.setHorizontalAlignment(JTextField.CENTER);
> % Add DataIn component to the figure.
> javacomponent(DataIn, [50 300 650 50]);
>
> % Add a field for DataIn to handles.
> handles.DataIn = DataIn;
> % Update handles structure
> guidata(hObject, handles);
>
> % Set the KeyReleasedCallback for DataIn component.
> set(DataIn, 'KeyReleasedCallback', @(hObject,
> eventdata)CountBitNum(handles));
>
> % Clear bits of DataIn to zeros.
> ClearBits(handles);
>
> % Initialzating completely.
> initialzated = 1;
>
> function CountBitNum(handles)
>
> % Display the bit count in BitCount component.
> set(handles.BitCount, 'String', length(handles.DataIn.getText()));
>
> function figure1_DeleteFcn(hObject, eventdata, handles)
>
> % Set initialzated to 0 for next starting GUI.
> global initialzated;
> initialzated = 0;
> ...
>
>
|