Borrar filtros
Borrar filtros

how write in edit text and send result to another edit text without pushbutton? PLEASE

2 visualizaciones (últimos 30 días)
I have a very simple gui program and I would like to add as a luxury that when in edittext enter the function in the other output edittext, automatically write the function already integrated. (my program integrates but, I want you to integrate without using a pushbutton) Can you?

Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Nov. de 2017
You can set a Callback function on the uicontrol('style','edit'). It will be called when the user presses return in the edit box or clicks outside the box.
  2 comentarios
Erwin Avendaño
Erwin Avendaño el 4 de Nov. de 2017
but I mean that for example the user in editext1 enters x and that automatically when entering x in edittext2 print x ^ 2/2 without the need for the user to press push button to integrate it Can you do that? sorry
Walter Roberson
Walter Roberson el 4 de Nov. de 2017
Editada: Walter Roberson el 4 de Nov. de 2017
function edittext2_Callback(hObject, event, handles)
formula = strtrim( get(hObject, 'String') );
if isempty(formula); return; end
form_expr = sym(formula);
form_int = int(form_expr);
form_int_char = char(form_int);
set(handles.text3, 'String', form_int_char); %send it to output location
And ensure that edittext2_Callback has been set as the Callback for edittext2
This is a callback for a uicontrol style 'edit'. It will be activated when the user presses Return after entering a new formula.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by