Thread Subject: Gui handles

Subject: Gui handles

From: Rikki

Date: 2 Jun, 2009 16:23:02

Message: 1 of 3

In my gui (which was not made by GUIDE), I would like to use the values from the edit text boxes to make a specific sized graph later on. I have tried many different ways of turning the values into handles and can't seem to get it working.

This is the code of that part:

function Width_callback(hObject,eventdata,handles)
        
        input = str2num(get(hObject,'String'));
        hW=get(handles.Width_editText, 'String');
        
end


function Height_callback(hObject,eventdata,handles)
        
        input = str2num(get(hObject,'String'));
        hH=get(handles.Height_editText, 'String');
end

set(hrec, 'Position',[1,1,hW,hH]);

The input is working but the handles are not.
Any ideas?

Subject: Gui handles

From: John

Date: 2 Jun, 2009 20:20:17

Message: 2 of 3

What are you doing with the 'input' variable ?
Are you getting an error message ? Paste it her.
Are Width_editText and Height_editText the 'tag' property values of your edit boxes ? If yes,Check in the property inspector if you have the tag property set to this or not ?

Subject: Gui handles

From: Rikki

Date: 3 Jun, 2009 15:13:02

Message: 3 of 3

"John" <sjohn@cnbc.cmu.edu> wrote in message <h041i1$jf5$1@fred.mathworks.com>...
> What are you doing with the 'input' variable ?
> Are you getting an error message ? Paste it her.
> Are Width_editText and Height_editText the 'tag' property values of your edit boxes ? If yes,Check in the property inspector if you have the tag property set to this or not ?

I'm trying to use the value from the String of the edit text box to determine the size of a plot.
When I do it one variable at a time, it works.
function Width_callback(hObject,eventdata,handles)
        W = str2num(get(hObject,'String'))
        set(hAx, 'Units','centimeters',...
            'Position',[1,1,W,20],...
            'XLim',[0,W],'XTick',0:.5:W,...
            'YGrid','on');
        axis equal
end

But I would like to determine the position with two separate variables, and the other one is stored in a different callback. I can't figure out how to turn W into a handle so that I can use it after the end of this callback function.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
guihandles Rikki 2 Jun, 2009 12:24:03
edittext Rikki 2 Jun, 2009 12:24:03
rssFeed for this Thread

Contact us at files@mathworks.com