GUI increment/decrement buttons linked to an Edit Text box

조회 수: 8 (최근 30일)
Peter
Peter 2013년 6월 13일
How can I create increment/decrement buttons in a GUI? I used GUIDE to create a slider linked to the value in an Edit Text box, but I have decided that I just want the increase/decrease arrow buttons and not the slider itself. I don't see an option to create such buttons anywhere.
I know that I can just create two separate push buttons, and it is probably possible to put a picture of an up/down arrow on them, but surely there is a function already made that can do this?
  댓글 수: 1
Kye Taylor
Kye Taylor 2013년 6월 13일
I don't know of any function... i'd do your two push-button idea.

댓글을 달려면 로그인하십시오.

채택된 답변

Chad Gilbert
Chad Gilbert 2013년 6월 13일
편집: Chad Gilbert 2013년 7월 18일
I've been thinking about doing something like this for a project I'm starting. Your question prompted me to just go make a first-pass attempt now.
Keep in mind it's a version 0.1 and may need a bit of fiddling still. But I was able to make the following example work:
lbl = uicontrol('Style', 'Edit', 'Enable', 'off','Units','Points','Position',[20 0 40 20],'String','0','Value',0);
grp = incrementdecrement(lbl, 0, 'Units', 'points', 'Position', [0 0 20 20]);
This just does what you suggested. We're creating two pushbuttons and just associating them with a common button group. This function should just make the process easier to repeat.
  댓글 수: 1
Peter
Peter 2013년 6월 13일
Thanks. That makes sense, I'm just surprised that no one has done this already.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by