prevent unchecking radio button by clicking on it in matlab - matlab

I created GUI using GUIDE and placed to radio buttons in one button-group panel. This conveniently takes care of unchecking one radio button whenever the other one is clicked. Now what's freaking me out is I can actually uncheck a checked radio button by clicking on it a second time, leaving BOTH radio buttons unchecked. It works with either of them. The only thing I want is the standard behavior, is that asking so much....?
I'm using Matlab 7.0, unfortunately this is all I've got.

I have 7.0 on one of my computers and r2011a on another and this non-standard behavior seems to be something that they fixed somewhere in between. Since MATLAB 7.0 is all you have, here is an easy way to fix it:
At the top of all radio button callbacks add:
if ~get(hObject,'Value')
set(hObject,'Value',1)
end
That should fix the problem.

Related

Editor tab disappeared in GUI

The MATLAB GUI normally (for me) has 4 tabs in the upper left - Home, Plots, Apps and (I think) Editor. However the editor tab has disappeared and I cannot find documentation how to turn it back on. I tried the Layout->Default but that just arranges all the visible windows and doesn't re-enable to missing editor.
Does anyone know how to turn this back on?
Type edit in the command window.
Unfortunately you are right, there is no 'Editor' option in the Layout panel of Matlab's interface, and for obscure reasons it's not present in the default layout.
OK, I've checked Ratbert's answer as he got here before me but Mathworks tells me it disappears any time you're not actually editing any code. If that happens their answer was to just click on the New Script button. Doing that worked for me. Typing edit in the command window is (I think) doing the same thing.
Thanks!
For anyone that finds this thread at a later date I eventually debugged the root cause of this problem as a mouse that was failing. When attempting to close the open variables part of the GUI, when clicking the X in the upper left, the mouse was generating two clicks instead of one. The first closed the variables GUI, the second closed the editing GUI. Purchasing a new mouse resulted in no longer seeing the problem at all.
in matlab command window, go on top right triagle and click, a drop down list will appear, select undock editor

Different behaviour when NSMenuitem is clicked vs Key Equivalent

All,
I have an odd one. I have a menu item that will directly lead to open a sheet (via beginSheet(,completionHandler:).
All is fine when I use it through the menu. But when I use the keyboard shortcut the resulting sheet behave differently.
Menu click behaviour: I show an NSOutline that works nicely. I can click etc.
Keyboard shortcut behaviour: the NSOutline cannot get any mouse events. Clicking doesn't lead to anything.
Interestingly enough, the closing button on the sheet is always working correctly.
Any ideas how I managed to get into this situation?
Many thanks in advance!

Adding New Components in WindowBuilder Design View

At risk of this being a trivial question, I need to know how to add more components (in the components explorer) in WindowBuilder for Eclipse Juno. I'm taking a dive and trying learn how to add a GUI to one of my personal projects. Right now all I have mustered up is just a JFrame that has a button that launches my program in the console with a little notification saying so. But what I am thinking about having is a "Start up Window" with just some stuff and button or something that says Enter application or something. So then I want a new window to pop up as a "Run Window". I have created a new JFrame as a "run window" and hide/set visibility of "startWindow" to false and get the result I want. But I want to be able to edit this new JFrame in the design window along with the default JFrame I started with.
Is there a way to do this? I tried right-clicking in the components window in the design view and it doesn't do anything. I also tried right-click the object from the project explorer and couldn't find anything. Am I missing something? Is this even possible?
The question seems to have 2 parts, so I will try to answer both of them.
1) Adding components directly in the components explorer
The only thing you could do, to get new components into there via right-click is "Surround with". For example you have a JPanel, right-click on it and click "Surround with...". You could try and put a JScrollPanel in there, so you can scroll your JPanel.
But the usual way to add components is by the "Palette", it contains a lot of components, that you can drag&drop into either the components-explorer or directly into your app Window -> Show View -> Palette.
2) Showing a certain window
If I understand this correctly, you want to show one window, click on a button and then show another window which has the same size etc. like the one before.
Setting the visibility for the first window to false and the second does work.
But under certain circumstances it's easier to use CardLayout.
Imagine a stack of cards, you can see only the first card. Then you click a button and now see the second card and so on.
See this: https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
for information and examples.

How to make a figure invisible the first time I open in in Matlab GUIDE

I'm making a GUI using matlab GUIDE. Since GUIDE doesn't support tabs, I have a pop down menu where the user selects different options. Depending on the selected options, certain buttons appear and disappear, this is easily handled by turning the handle visibility on/off.
However, the first time I run the GUI, i can see all my buttons, even though their default handle visibility is off. The moment I select something from the pop down menu, everything is fine.
How do I make a figure invisible for the very first time the GUI is opened?
Thanks!
Try the drawnow command at the end of the initialization code of your GUI (see doc here). It should force the update of the GUI and hopefully set the visibility of your objects correctly.

How do you prevent an Excel / ActiveX Command Button from being moved/edited, but allow it to be clicked

I've got an ActiveX Command Button on a WorkSheet. I will be protecting the worksheet and need the button so it cannot be moved or changed, but still want it to be clickable.
How can I achieve this?
Go ahead and protect the sheet. If macros are enabled the button should remain click-able.