Unable to add uicontrol to uifigure
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Marc Elpel
el 5 de Mzo. de 2021
Comentada: Marc Elpel
el 5 de Mzo. de 2021
I'm trying to build a custom form with drop down menus and edit boxes for data entry. The drop-downs are dynamic/set by user selections in the other items.
I was able to built the figure using dropdown and buttons, but when I tried adding an edit box the code failed with error "Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer."
I've tried changing from uifigure to figure, but that breaks other parts of the code.
Some specifics:
- Main app designed in App Designer
- Main App calls separate class defined as Tasks < handles (define as handles so the obj passed to callbacks worked properly)
- Tasks creates a separate figure which gets user input and uses uiwait to hold until done.
- Everything works for the drop-downs, but cannot add the edit box to get a value from a user. (online help suggests creating the edit box via uicontrol which creates the error above.)
Creation code (editted down to key parts)
classdef Tasks < handle
...
function obj = Tasks()
% Create figure for user input
obj.Figure = uifigure('Position',[100 100 400 300]);
% Create and populate the task list dropdown selections
obj.lbTasks = uidropdown(obj.Figure,'Items',obj.TaskNames, ...
'Position',[50,250,150,25],'ValueChangedFcn', @obj.figInputs_Changed);
% Create & populate the consumable object list
obj.lbObjects = uidropdown(obj.Figure, 'Items', {'Component'}, ...
'Position',[225,250,150,25],'Enable','off','ValueChangedFcn', @obj.figInputs_Changed);
% Create an edit box for entering values
obj.edValue = uicontrol(obj.Figure, 'Style', 'edit', ...
'Position',[50,200,150,25],'Enable','off','ValueChangedFcn', @obj.figInputs_Changed);
% Create the Save and Cancel buttons
obj.btnSave = uibutton(obj.Figure, 'Text', 'Save', ...
'Position',[100,50,80,25],'ButtonPushedFcn', @obj.BtnPushed_Callback);
obj.btnCancel = uibutton(obj.Figure, 'Text', 'Cancel', ...
'Position',[200,50,80,25],'ButtonPushedFcn', @obj.BtnPushed_Callback);
end
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!