I'm trying to implement a resizable MATLAB UI. But I'm encountering a lot of problems.
In fact, the use of the normalized command is compulsory in order to have a window that automatically resize its content. However the 'normalization' of the uicontrol items it is not always the same. For instance the popupmenu is different from the text and edit. Moreover the FontSize has another behavior with respect to the previous ones.
Is there a simple tutorial out there in which all this stuff is explained?
I didn't find any.
If you're doing this, I would seriously recommend using Ben Tordoff's GUI Layout Toolbox, available from the MATLAB Central File Exchange. It gives you GUI resizing almost for free, and much else besides, such as movable panels and well-implemented tab controls. It comes with good documentation, including some simple tutorials and a decent worked-through example.
Ben is from MathWorks consulting group, and the toolbox is used widely by MathWorks when delivering consulting projects. Although it's not a 'supported' MathWorks product, it's very reliable, and it's freely available for you to include in your own projects.
Without this, it's a huge pain to implement resizing on a GUI of any complexity - to do it properly you can't just rely on the 'normalized' property, you need to implement the ResizeFcn callback on everything, and pretty much re-lay everything out each time there's a resize.
Related
I would like to be able to add a figure container to a matlab gui...
In core matlab, with a docked window style you can have a large number of plots stacked one behind the other, all within a figure container with a tabbed list along the side of the container that you can simply click to bring a particular figure to the front.
Is there a way to have this sort of figure container in a matlab gui?
Use Ben Tordoff's GUI Layout Toolbox. It contains functionality for tabbed panels and dockable/undockable panels that can contain figures, and many other capabilities that you'll find very useful if you are creating GUIs in MATLAB.
You will need to organize your GUI code slightly differently, but it's not hard to learn and there are great examples in the documentation.
It's not really possible to do what you're describing with just regular MATLAB: figures will just dock into the main MATLAB desktop, not into your GUI specifically. The best way (without GUI Layout Toolbox) would probably be to fake a row of tabs using buttons next to each other, with callbacks on the buttons that deleted/hid one plot and drew/revealed another. There is a function uitab that does tabs, but before R2014b it's undocumented, and it's a bit of a pain anyway. Better all round to use GUI Layout Toolbox.
If you're open to play around with undocumented features, this can be done using the java objects behind the matlab figures, e.g. using a little tool from the fileexchange.
This will create a new dock group, just like MATLAB's container for figures, editor etc.
This is not completely a programming question. Today when I load LiLi USB creator software I saw the interfaces are transparent. Is that because they are Photoshopped or is transparency a technique of IDE? I'm using both NetbBeans and Eclipse. To be clear, I'm adding a photo too.
For transparency of the entire GUI, including controls (which doesn't seem to be the case in your screenshot), .NET includes the Form.Opacity property.
Additionally, it may be possible to use LayeredWindows to change only the opacity of the top-level component to produce the desired effect.
For Java specifically, there's an official Java tutorial for that, although it seems to set the opacity of the entire window, including all child components.
I have created a basic MATLAB UI (without using GUIDE). I basically have a bunch of panels for various things, (sliders, axes, text boxes, etc).
The one thing I would like to do though, it make it so that they scale properly, when I resize the figure. Right now, I painstakingly have to make a re-scale function for every button, panel, sub-panel, etc etc to make it rescale correctly.
Is there an easy way to simply automate the re-scaling here?
Thanks.
Use the GUI Layout Toolbox from the MATLAB File Exchange. I haven't personally used dynamic resizing functionality, but that's one benefit of using this package.
It functions much like using uicontrols, except you can't use the inspect tool on these objects.
EDIT: If you're looking only to do resizing when the figure itself is resized, set the Units property for all your uicontrols to normalized.
You could also use the builtin, but undocumented uigridcontainer and uiflowcontainer.
They have the benefit of e.g. allowing to set contraints, such that e.g. your pushbuttons don't get increased in size, when the full figure does. Check the link for some examples:
http://undocumentedmatlab.com/blog/matlab-layout-managers-uicontainer-and-relatives/
I am programming with wxPerl and I was wondering how you would design it so that a textctrl, or really any component, would fill up the entire frame and resize with the window?
So far my attempts at researching this problem have led me to believe that potentially using the wxBoxSizer is the way to go but documentation for wxPerl is a little scarce..
Thank you all for any help
The documentation for the wxWidgets API is excellent and very comprehensive. wxPerl exposes most of the API in a stratightforward manner.
If a Wx::Frame object has only a single child window, the default size event handler automatically resizes the child to fill the frame.
If you have a more complex requirement then you can overload the handler or, as you say, write a sizer.
This isn't strictly a programming question, but I'm asking it here because it's certainly a software development question, if you take "software development" to include all aspects of creating a software system.
I am an independent iPhone developer. Except for translations, I handle all aspects of my apps myself—graphics included. I have to create icons, buttons, and UI elements of all sorts on a regular basis. I've learned a few tricks along these lines, and while they're certainly not works of art, I can effectively use gradients, shadows, border strokes, transparency, and textures to create minimalistic, attractive effects.
So far, I've used a vector drawing tool called VectorDesigner for all of my development, with occasional raster postprocessing by Pixelmator. It's worked mostly okay so far, but VectorDesigner has a host of issues:
It uses a package format for its files, which interferes with the use of Subversion.
It is very much a print tool, and I have to be very careful not to end up with objects on fractional pixel values which cause antialiasing.
While you can take the union or intersection of shapes, or add and subtract them, curves tend to deform with repeated boolean operations, sometimes quite dramatically.
And it offers very little control over strokes, to the point where I barely use them.
So I'm looking for a better tool for this specific purpose: shape-based drawing of simple icons, buttons, and UI elements on a Mac by someone without graphic design training. Good functions for exporting would be a plus—ideally it should be almost as easy to export a PNG to the place it goes in my project as it is to save (not save as) the file.
The perfect tool for me would be one that would allow you to define an object's shape by stacking up areas and masks defined by primitive shapes (which would remain separately editable), then define properties on those objects like transforms and strokes. I have no idea if something like this exists, though.
Adobe's tools generally strike me as very heavyweight, and are usually expensive, but I suppose they're a possibility. (Fireworks, with its emphasis on screen design, seems like it might be particularly suitable, but I don't know that much about it.) But what else is out there? If you're in a position like me, what do you use? What do you recommend?
Edited to add: Of course a graphic designer could get better results from an ancient copy of MacPaint than I could from Illustrator CS5. No tool can replace skill and taste, and many programmers have little of either. I'm aware of that. But I'm fortunate enough to have at least some taste—enough that my users compliment my apps' appearance in their reviews. I'm not hugely talented, but I do know my limitations, and I don't let myself produce anything ugly. Given my budget, that will have to do for now.
Try Opacity. A little rough on the edges, but one of the coolest and most unique features they have is export as source code (in Quartz, Cocoa, Cocoa Touch, or Canvas)
I'd suggest OmniGraffle
OmniGraffle is easy to use, can save as a PNG, can create binary non-package files (it's an option in the interface). You can also set the units to pixels to ensure exact alignment. (Canvas Size -> Ruler Units)
Finally, the Graffletopia website has some nice iPhone stencils for getting it right:
http://graffletopia.com/search/iphone
I think the only acceptable answer here should be "hire a designer".
But it sounds like Pixelmator/Inkscape are your best bets.
Though if you do find something better, that'd be really cool. Like a jQueryUI but for native.