Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
gui edit

Subject: gui edit

From: Muhammad

Date: 11 Apr, 2010 16:18:03

Message: 1 of 5

Hi ....
This is my GUI edit setting.
handles.Manual=uicontrol(...
      'Parent',handles.Cuaca,...
      'Units','normalized',...
      'Position',[.58,.1,.2,.28],...
      'BackgroundColor','w',...
      'HorizontalAlignment','left',...
      'Style','edit',...
      'FontSize',11,...
      'Min',1,...
      'Max',4,...
      'String','',...
      'Callback',@ManualPrediction);

function ManualPrediction (hObject,eventdata)
        handles.PManual=[get(handles.Manual,'String')]
          set(handles.Test,'String',handles.PManual)
 end
How can I get a string in a certain number in my edit text?
for example just access in line 1 and 2 not all
Very thanks.

Subject: gui edit

From: Walter Roberson

Date: 11 Apr, 2010 16:36:48

Message: 2 of 5

Muhammad wrote:
> Hi ....
> This is my GUI edit setting. handles.Manual=uicontrol(...
> 'Parent',handles.Cuaca,...
> 'Units','normalized',...
> 'Position',[.58,.1,.2,.28],...
> 'BackgroundColor','w',...
> 'HorizontalAlignment','left',...
> 'Style','edit',...
> 'FontSize',11,...
> 'Min',1,...
> 'Max',4,...
> 'String','',...
> 'Callback',@ManualPrediction);
>
> function ManualPrediction (hObject,eventdata)
> handles.PManual=[get(handles.Manual,'String')]
> set(handles.Test,'String',handles.PManual)
> end

You do not appear to be passing in 'handles', so where will
handles.Manual and handles.Test come from? Is ManualPrediction a
function that is nested within something else that has access to handles ?


> How can I get a string in a certain number in my edit text?
> for example just access in line 1 and 2 not all

That isn't possible, unless perhaps by going in at the Java level. You
have to get the entire String and then use the parts of that that you
want, and you have to set() the entire String, not just part of it.

Subject: gui edit

From: Muhammad

Date: 11 Apr, 2010 16:46:03

Message: 3 of 5

Walter Roberson <roberson@hushmail.com> wrote in message <hpstr1$coc$1@canopus.cc.umanitoba.ca>...
> Muhammad wrote:
> > Hi ....
> > This is my GUI edit setting. handles.Manual=uicontrol(...
> > 'Parent',handles.Cuaca,...
> > 'Units','normalized',...
> > 'Position',[.58,.1,.2,.28],...
> > 'BackgroundColor','w',...
> > 'HorizontalAlignment','left',...
> > 'Style','edit',...
> > 'FontSize',11,...
> > 'Min',1,...
> > 'Max',4,...
> > 'String','',...
> > 'Callback',@ManualPrediction);
> >
> > function ManualPrediction (hObject,eventdata)
> > handles.PManual=[get(handles.Manual,'String')]
> > set(handles.Test,'String',handles.PManual)
> > end
>
> You do not appear to be passing in 'handles', so where will
> handles.Manual and handles.Test come from? Is ManualPrediction a
> function that is nested within something else that has access to handles ?
>
handles.Test is the edit text also. I want to make a copy text in specific lines to other edit text.

ManualPrediction is only a callback function for handles.Manual and doesn't related to other function.
Is it still possible?
How?
>
> > How can I get a string in a certain number in my edit text?
> > for example just access in line 1 and 2 not all
>
> That isn't possible, unless perhaps by going in at the Java level. You
> have to get the entire String and then use the parts of that that you
> want, and you have to set() the entire String, not just part of it.

Subject: gui edit

From: Yair Altman

Date: 12 Apr, 2010 05:23:04

Message: 4 of 5

> > How can I get a string in a certain number in my edit text?
> > for example just access in line 1 and 2 not all
>
> That isn't possible, unless perhaps by going in at the Java level. You
> have to get the entire String and then use the parts of that that you
> want, and you have to set() the entire String, not just part of it.


Multi-line editbox customizations are described here:
http://undocumentedmatlab.com/blog/setting-line-position-in-edit-box-uicontrol/
http://undocumentedmatlab.com/blog/rich-matlab-editbox-contents/
http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/

Note that all these customizations are Java-based and therefore undocumented and not officially supported by MathWorks. They work splendidly, but don't complain if they stop working in some future Matlab version...

Yair Altman
http://UndocumentedMatlab.com

Subject: gui edit

From: Walter Roberson

Date: 13 Apr, 2010 04:08:34

Message: 5 of 5

Muhammad wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
> <hpstr1$coc$1@canopus.cc.umanitoba.ca>...
>> Muhammad wrote:
>> > Hi ....
>> > This is my GUI edit setting. handles.Manual=uicontrol(...
>> > 'Parent',handles.Cuaca,...
>> > 'Units','normalized',...
>> > 'Position',[.58,.1,.2,.28],...
>> > 'BackgroundColor','w',...
>> > 'HorizontalAlignment','left',...
>> > 'Style','edit',...
>> > 'FontSize',11,...
>> > 'Min',1,...
>> > 'Max',4,...
>> > 'String','',...
>> > 'Callback',@ManualPrediction);
>> > > function ManualPrediction (hObject,eventdata)
>> > handles.PManual=[get(handles.Manual,'String')]
>> > set(handles.Test,'String',handles.PManual)
>> > end
>>
>> You do not appear to be passing in 'handles', so where will
>> handles.Manual and handles.Test come from? Is ManualPrediction a
>> function that is nested within something else that has access to
>> handles ?
>>
> handles.Test is the edit text also. I want to make a copy text in
> specific lines to other edit text.
>
> ManualPrediction is only a callback function for handles.Manual and
> doesn't related to other function.
> Is it still possible?

No, it isn't possible under your constraint that ManualPrediction must
not be related to any other function.

In order to get your callback to work, you will have to find a way to
communicate the handles.Manual and handles.Test objects (which are
defined outside of the callback) into the callback. I think I've heard
rumours of a gethandles() function that might be appropriate.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us