Get a list of all UI Components used in GUI
2 views (last 30 days)
Show older comments
Hi All!
I'm working on a program which has several input fields, takes the filled in information by the user and starts a query to a database with the specified conditions (something like "SELECT * FROM Foo WHERE Field = 'specified value' AND (...)"). The retrieval works fine, but my approach is really cumbersome and errorprone at the moment. Here is how i construct the WHERE-clause:
function where_clause = constructWhereClause(handles)
where_clause = '';
bezeichnung_arr = get(handles.bezeichnung_edit, 'UserData');
if ~isempty(bezeichnung_arr{2})
where_clause = [ bezeichnung_arr{1} '=''' bezeichnung_arr{2} ''''];
end
derivat_arr = get(handles.derivat_popup, 'UserData');
if ~isempty(derivat_arr{2})
if ~isempty(bezeichnung_arr{2})
where_clause = [where_clause ' AND '];
end
where_clause = [where_clause derivat_arr{1} '=''' derivat_arr{2} ''''];
end
My question is: Is there a way to get a list of all ui components of a gui so I can iterate over them and access their "UserData" property in a for-loop? Since there are many edit fields more to come, this approach will not be the best to construct my statement.
Thanks in advance!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!