Guide not generating callbacks

Hi,
I have a GUI that is made with GUIDE. The GUI works but when I have to modify the GUI with an extra button or something, I click View>Callbacks on the new button and GUIDE does not automatically generate new callback function for it.
Does anyone know the cause for this?
Horace

5 件のコメント

Nick
Nick 2013 年 1 月 28 日
Have you tryed saving the new gui? In my experiance the new callbacks are only made after you pressed save.
Horace
Horace 2013 年 1 月 28 日
I have tried saving the new modifications, if that is what you mean. I already have an existing GUI where GUIDE used to automatically generate callbacks. Now when I make add some modifications, it does not generate the new callbacks, even after saving.
Nick
Nick 2013 年 1 月 28 日
編集済み: Nick 2013 年 1 月 28 日
I will describe how I add a new button;
  1. In matlab press GUIDE
  2. Open Existing GUI
  3. C:\MyGui
  4. Now add a Push Button
If I use your method ViewCallbacks>callback in my code there appears a new function named: pushbutton2_Callback(hObject, eventdata, handles). Somthimes it is named "Newfunction"
If that does not work you can try my method:
  1. Right click the new pushbutton and select property inspector.
  2. Go to "Tag" you can find this on the left side 7th from the bottom
  3. On the right side of "Tag" you see the text "Push Button"
  4. Replace this text with w/e you want your function to be named for example: NewPushbutton
  5. now close the inspector
  6. On your guiscreen pres the save button
if it is correct you will now get your new function code looking like:
% --- Executes on button press in NewPushbuttonTag.
function NewPushbuttonTag_Callback(hObject, eventdata, handles)
% hObject handle to NewPushbuttonTag (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Maybe this different method will help
Horace
Horace 2013 年 1 月 28 日
Hi Nick,
Unfortunately that didn't work either. Sighhh
Nick
Nick 2013 年 1 月 28 日
Hello Horace,
Well the last thing I can think of than is to save the entire gui with new button with a different file name. And coppy paste the code you already wrote to the new file.

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

回答 (1 件)

Sean de Wolski
Sean de Wolski 2013 年 1 月 28 日

2 投票

Hi Horace,
If you navigate to Tools->GUI Options, is "generate callback function prototypes" enabled?

5 件のコメント

Horace
Horace 2013 年 1 月 28 日
YES! That was the issue! Thanks!
Sean de Wolski
Sean de Wolski 2013 年 1 月 28 日
Great; One success for the week already!
Please accept this answer.
Image Analyst
Image Analyst 2013 年 1 月 28 日
Another dog!? I didn't know you had two.
Sean de Wolski
Sean de Wolski 2013 年 1 月 28 日
編集済み: Sean de Wolski 2013 年 1 月 28 日
Yup!
My wife (whose parents have sled dogs) wants a third since we're trying to get into ski-jouring. However, the snow gods aren't cooperating.
Maoen He
Maoen He 2020 年 8 月 9 日
So great!
It is effective for me!

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

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

質問済み:

2013 年 1 月 28 日

コメント済み:

2020 年 8 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by