Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
21 Jan 2008 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams hongx, zhang

Could you give an exact examplt,please?I try the function,but the effect of the buttons.I'm sorry to disturb you! Thank a lot!

07 Jan 2008 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams P, V

Geoffrey, please, sorry for misprint.

06 Jan 2008 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams P, V

>>just saving small versions of them for use in your program.

Thanks, Jeoffrey, that's exactly what I currently do.

02 Jan 2008 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams Adams, Geoffrey

Hello again, Vassili.

As of R2007b, the help documentation on the CData property of uipushtool objects states:

"If your CData array is larger than 16 in the first or second dimension, it may be clipped or cause other undesirable effects. If the array is clipped, only the center 16-by-16 part of the array is used."

Therefore it seems that the "official" behavior for oversized icons is clipping rather than scaling. If you wish to use larger icons and scale them down to size, it seems you will have to do it manually. If you have access to the Image Processing Toolbox, you could use the IMRESIZE function, but this would create additional computational overhead every time you want to add these buttons to a figure. I would suggest rescaling your icons ahead of time in an image manipulation program like the GIMP or Photoshop, and just saving small versions of them for use in your program.

Good luck.

01 Jan 2008 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams P, V

I confirm my fears that CData for uipushtool ARE NOT resized automatically. If I use as CData some image from a file, and look what is the size of CData in the icon, like:

h=uipushtool(tb(1), ...
               'Tag', 'MoveBackwardTool', ...
               'HandleVisibility', 'off', ...
               'Separator', 'on', ...
               'TooltipString', 'Move Current Plot Object Backward', ...
               'CData', backward_cdata, ...
               'ClickedCallback', @MoveObjBackward);
end

d=get(h,'CData')
size(d)
......
function c = backward_cdata
c=imread('iconx.jpg'); %big green X at red %background
return

then I see
size(d)=[800 1200 3]

It is not excluded that in later versions of ML this point was corrected (I have R14). Was it?

31 Dec 2007 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams P, V

Hi, Geoffrey,
Happy New Year to you!

Say,
my_icon.bmp has size 100*100.
Now if i do

img = imread('my_icon.bmp');
c = double(img)./255;

and if I use c as my CData, will it have size 20*20? I find, size 100*100 for an icon is too luxury.

About icon group: your two icons are so similar, that in the absense of aNY separator a not very experienced eye could accept both icons as one "extended" button. Were the icons not that similar, the reasoning about icon groups could win. But, you know, this was only my first impression.
best,
Vassili

31 Dec 2007 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams Adams, Geoffrey

Hi V P,
You are probably correct about the icon definitions. I just wanted to avoid having to include separate files for the icons. If you prefer to make your own icons, it should be pretty straightforward to replace the code in the FORWARD_CDATA and BACKWARD_CDATA functions in AddReorderButtons.m with code like:

img = imread('your_icon.bmp');
c = double(img)./255;

As for your second point, the standard MATLAB figure toolbar (as with most programs' toolbars) uses separators only to delineate groups of functionally similar buttons. Since the "forward" and "backward" buttons form a functional group, I felt it would be more in accordance with standard MATLAB GUI style not to place a separator between the two buttons. Of course, you are free to change this to your own preference.

30 Dec 2007 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams P, V

Two good things in this submission:

1. It matches one of my remarks to recent "Drag patch demo" of Josef Kirk.
2. A good demo how to append an UIPUSHBUTTON to toolbar.

I have two small remarks.

1. Do your CData for uipushtool really need such a heavy definition? I have a simple program MAKEICON which makes a 20*20 truecolor matrix out of an rgb image. However, if I submit it, I am afraid to be accused of primitivism or ignorance of last ML developments.

2. It seems that in your code

'Separator', 'off', ...
'TooltipString', 'Move Current Plot Object Backward'

'on' would more consistent.

Otherwise, good job.

28 Dec 2007 AddReorderButtons Add toolbar buttons to move plot objects forward and backward within axes. Author: Geoffrey Adams Ali, M.Tauha

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com