Matlab GUI callback troubles

前端 未结 2 1581
忘掉有多难
忘掉有多难 2021-01-29 06:56

I try to make the uipanel change boarder colors while pressing and releasing mouse button on elsewhere except inputs and panel buttons.

function    [oldpropvalu         


        
2条回答
  •  感情败类
    2021-01-29 07:11

    Your problem is that you're defining your window callbacks as character vectors, which are evaluated in the base workspace where the variable varargin doesn't exist. You can define them as anonymous functions instead:

    set(varargin{1}, 'WindowButtonDownFcn', ...
        @(~, ~) set(varargin{2}, 'BorderType', 'line', 'BorderWidth', 2, ...
                    'HighlightColor', [0 0 0]));
    set(varargin{1}, 'WindowButtonUpFcn', ...
        @(~, ~) set(varargin{2}, 'BorderType', 'beveledout', 'BorderWidth', 1, ...
                    'HighlightColor', [1 1 1]));
    

提交回复
热议问题