Prev: Javabuilder problem; Can't find nativemcl.dll
Next: weird issue with complex signum, see below:
From: Ryan on 18 Jun 2010 21:32 I am making a GUI, and the first thing the user does is push one of two toggle buttons, which are in a uibuttongroup. When one of the toggle buttons are pushed, the 'SelectionChangeFcn' enables or disables other buttons, and this works properly. If I then push another button, the first part of the callback works properly, but then when it encounters a line of code, such as: set(FG.Import,'Enable','off') the it says that FG is empty, which is a struct I keep all of my button handles in. I do nothing that might delete FG, and I can't figure out why FG would be deleted. Any suggestions anyone? Ryan
From: Matt Fig on 18 Jun 2010 22:06 How is the FG struct being passed around? Is this a GUIDE GUI? If it is not, did you assign the FG struct to be passed into the callbacks before it was completely created?
From: Ryan on 19 Jun 2010 00:22 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hvh8mb$5eu$1(a)fred.mathworks.com>... > How is the FG struct being passed around? Is this a GUIDE GUI? If it is not, did you assign the FG struct to be passed into the callbacks before it was completely created? this is not a GUIDE GUI. after declaring the function, global FG is declared and the variable Action is declared as 'initial'. then a switch is declared, and the GUI figure handle and uicontrol handles are all declared and placed in the FG struct. all gui buttons etc are declared in case 'Initial'. an inline function is used for the selectchangefcn, which controls two toggle buttons in a uibuttongroup, and cases are used for the callbacks on all other buttons. function NA(action) Global FG Action = Initial switch (Action) case 'Initial' FG.g1 = uibuttongroup(... 'selectionchangefcn',@g1func) % declare toggle buttons in this group % declare other buttongroups and put buttons in them % suppose one of these buttons has the callback declation % 'Callback','NA FG.test1' case 'test1' % contains code that changes FG end function g1func(source,eventdata) x=get(eventdata.NewValue,'string') switch x case 'handle of first toggle button' % code that modifies FG case 'handle of second toggle button' % code that modifies FG end end end the GUI and all buttons appear when this script is run. i can use both toggle buttons and they do what they are programmed to do. when i then push a button that calls the test1 callback, which references a handle stored in FG, an error tells me FG is a non-structure array and if i put disp(FG) in the callback FG is empty. Any idea why this is happening?
From: us on 19 Jun 2010 00:28 "Ryan " <jryanrigby(a)gmail.com> wrote in message <hvhglc$arm$1(a)fred.mathworks.com>... > "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hvh8mb$5eu$1(a)fred.mathworks.com>... > > How is the FG struct being passed around? Is this a GUIDE GUI? If it is not, did you assign the FG struct to be passed into the callbacks before it was completely created? > > this is not a GUIDE GUI. after declaring the function, global FG is declared and the variable Action is declared as 'initial'. then a switch is declared, and the GUI figure handle and uicontrol handles are all declared and placed in the FG struct. all gui buttons etc are declared in case 'Initial'. an inline function is used for the selectchangefcn, which controls two toggle buttons in a uibuttongroup, and cases are used for the callbacks on all other buttons. > > function NA(action) > Global FG > Action = Initial > > switch (Action) > case 'Initial' > FG.g1 = uibuttongroup(... > 'selectionchangefcn',@g1func) > % declare toggle buttons in this group > > % declare other buttongroups and put buttons in them > % suppose one of these buttons has the callback declation > % 'Callback','NA FG.test1' > > case 'test1' > % contains code that changes FG > end > > function g1func(source,eventdata) > x=get(eventdata.NewValue,'string') > switch x > case 'handle of first toggle button' > % code that modifies FG > case 'handle of second toggle button' > % code that modifies FG > end > end > > end > > the GUI and all buttons appear when this script is run. i can use both toggle buttons and they do what they are programmed to do. when i then push a button that calls the test1 callback, which references a handle stored in FG, an error tells me FG is a non-structure array and if i put disp(FG) in the callback FG is empty. > > Any idea why this is happening? in your callback G1FUNC you use your data struct FG... but: where does it come from(?)... us
From: Ryan on 19 Jun 2010 01:40 > in your callback G1FUNC you use your data struct FG... > but: where does it come from(?)... > > us every time i declare a handle for a button, i declare the handle as a field in FG. for example FG.button1handle = uicontrol(...
|
Next
|
Last
Pages: 1 2 3 Prev: Javabuilder problem; Can't find nativemcl.dll Next: weird issue with complex signum, see below: |