help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function handle with arguments for GUI callback


From: Arnaud Miege
Subject: Re: Function handle with arguments for GUI callback
Date: Wed, 13 Mar 2013 11:45:37 +0000

It looks like there is a constant offset of 48 between what the value of k is and what it should be, so for now, I am using the following:

function update_browse_btn(src,data,k,gui)
% Called when user activates popup menu 
        val = get(src,'Value');
        if val == 2
            set(gui.browse_btns{k-48},'Enable','on');
set(gui.ip_file_edit{k-48},'Enable','on');
else
set(gui.browse_btns{k-48},'Enable','off');
set(gui.ip_file_edit{k-48},'Enable','off');
        end
end

This works well for all the scenarios and all possible values of k, but I am slightly uneasy at having an unexplained, hard-coded, offset in the code, even if this is only a prototype (the final version will probably be coded in C# for deployment to end-users). Anyway, it does the job for now until I find a more elegant and more robust solution.

Thanks,

Arnaud


On 12 March 2013 09:02, Arnaud Miege <address@hidden> wrote:



On 11 March 2013 18:31, Michael Goffioul <address@hidden> wrote:

This is standard Matlab behavior:
(look for  "Use Cell Arrays with Strings")

You are right of course, sorry.
 

As the object is a cell array, you need to index it with {}, but from what you saying, it doesn't work either. Does it change anything if you do an assignment instead:

x = gui.browse_btns{k}
x

No IVm afraid it doesn't. Don't know why it says k is 49 when used to index, and 3 when displaying it.

I will maybe try tagging the different uicontrols to circumvent the problem.

 Thanks,

Arnaud



reply via email to

[Prev in Thread] Current Thread [Next in Thread]