use color bar as item in App-designer drop down list

4 ビュー (過去 30 日間)
Yu Li
Yu Li 2019 年 5 月 17 日
編集済み: Adam Danz 2019 年 5 月 23 日
Hi:
I want to update my app-designer to select color, what I have now, is either to use color name ('r','b') or RGB value as a element of drop down list.
I want to see if there is anyway to make it more interactive, for example, the drop down list can show a list of color block, as the figure attached.
Capture.JPG
is there anyway to do this?
Thanks!
Yu

回答 (1 件)

Adam Danz
Adam Danz 2019 年 5 月 18 日
編集済み: Adam Danz 2019 年 5 月 22 日
I don't think that's possible in app designer. Here's are two alternatives that will require a little work but they're doable.
Idea 1: clickable axis
You could add a new axis in place of the drop down list (same location, same shape) and it can display the blocks of colors as in your image. That's easy using rectangle() or patch() or fill().
Then you can use ginput() to capture the location of the mouse click within the axes. Once you have that coordinate, there are several ways you could determine which rectangle the click was in. Then grab the color values from that rectangle.
Idea 2: colored buttons
I think I like this idea better. You could add a stack of small buttons (button group) that do not contain any text but are merley colored (as in your image). When the user selects a certain button, a callback function can assign the color value.
Idea 3: use a knob
In app designer you can use a discrete knob so the user can select a color. Next to the knob you could have a tiny axis or botton that changes color with the knob selection so the user can see the result.
If you get stuck while implementing any of these ideas, I'd be happy to continue the discussion.
  2 件のコメント
Yu Li
Yu Li 2019 年 5 月 22 日
Thanks for your reply. I think they are all not as perfect as what I have expected.
I have contacted Mathworks and they have add enhancement request of this feature for future release.
Bests,
Yu
Adam Danz
Adam Danz 2019 年 5 月 22 日
編集済み: Adam Danz 2019 年 5 月 23 日
Ok :) These ideas above can all be implemented fairly easily. Waiting for the feature update (if it's ever implemented) will take months or years. Just FYI.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by