⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daqpropedit - what can do one comma.txt

📁 有一个小的错误数据采集财产编辑线225 : data.ObjectList ( CT表现1 :电脑断层+ numChildren
💻 TXT
📖 第 1 页 / 共 3 页
字号:
        set(data.hUI(3:5),'ForegroundColor',[0 0 0]);
    end
  end %if ~curPropInfo.ReadOnly
end % if ~isempty

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% LSubPropertyChange %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function data=LSubPropertyChange(data)
% Called from property selection change in listbox and 
% from LSetProperty
% Also called during initialization of the figure

pText='off';
pPopup='off';
pEdit='off';
pStr='';
data.ToWorkspace=logical(0);
data.WorkspaceVariableName='';
pVal=1;
value=get(data.hUI(1),'Value');

% Must have a valid object and a single valid property selected
if ~isempty(data.CurrentObj) && data.ValidProp && length(value)==1,
  data.CurrentProp=data.PropList{value};
  set(data.hUI(2),'String',data.CurrentProp)
  
  curPropInfo=propinfo(data.CurrentObj,data.CurrentProp);
  if strcmp(curPropInfo.Constraint,'Enum'),
    pPopup='on';
    pStr=curPropInfo.ConstraintValue;
    pVal=find(strcmp(pStr,get(data.CurrentObj,data.CurrentProp)));

  else
    if curPropInfo.ReadOnly,    
      pText='on';
    else
      pEdit='on';
    end
    
    
    val=get(data.CurrentObj,data.CurrentProp);
    [pStr,noneditFlag]=LGetValueString(data,val);
    
    if noneditFlag,
      %it's going to the workspace
      data.ToWorkspace=logical(1);
      data=LGetWorkspaceVariableName(data);
      pStr=data.WorkspaceVariableName;
      assignin('base',pStr,get(data.CurrentObj,data.CurrentProp));
    end
    
  end  
  
  if curPropInfo.ReadOnly,    
    pEnable='off';
  else
    pEnable='on';
  end
  
  if ischannel(data.CurrentObj) || isdioline(data.CurrentObj),
    tempObj=get(data.CurrentObj,'Parent');
  else
    tempObj=data.CurrentObj;
  end
  if strcmp(tempObj.Running,'On'),
    if curPropInfo.ReadOnlyRunning,
      pEnable='off';
    end
  end
  
else
  pText='on';
  pStr='';
  pEnable='on';
end

if strcmp(pEnable,'off')
  if strcmp(pText,'on'),
    pEnable='on';
  elseif strcmp(pEdit,'on'),
    pEnable='on';
    pText='on';
    pEdit='off';
  end
end
  

set(data.hValText, ...
    'ForegroundColor',[0 0 0], ...
    'Visible'        ,pText  , ...
    'String'         ,pStr   , ...
    'Enable'         ,pEnable  ...
    );
set(data.hValPopup  , ...
    'ForegroundColor',[0 0 0], ...
    'Visible'        ,pPopup , ...
    'String'         ,pStr   , ...
    'Value'          ,pVal   , ...
    'Enable'         ,pEnable  ...
   );
set(data.hValEdit, ...
    'ForegroundColor',[0 0 0], ...
    'Visible'        ,pEdit  , ...
    'String'         ,pStr   , ...
    'Enable'         ,pEnable  ...
   );

data=LCreateListboxString(data);

% Set the property info for the current property
helpStr=' ';
typeStr='';
defValStr='';
constraintStr='';
constraintValStr='';
readOnlyStr='';
devSpecificStr='';
roRunningStr='';

if ~isempty(data.CurrentObj),
  info=propinfo(data.CurrentObj,data.CurrentProp);
  helpStr=evalc('daqhelp(data.CurrentObj,data.CurrentProp)');
  helpStr=LConvertEvalCString(helpStr);
  % Rip off the leading carriage return
  helpStr(1,:)='';
  typeStr=LConvertToString(info.Type);
  defValStr=LConvertToString(info.DefaultValue);
  constraintStr=LConvertToString(info.Constraint);
  constraintValStr=LConvertToString(info.ConstraintValue);
  readOnlyStr=LTrueFalse(info.ReadOnly);  
  devSpecificStr=LTrueFalse(info.DeviceSpecific);
  roRunningStr=LTrueFalse(info.ReadOnlyRunning);
end

% Set the property help for the current property
set(data.hInfo(1),'String',helpStr,'Value',[]);
set(data.hInfo(15),'String',typeStr);
set(data.hInfo(13),'String',defValStr);
set(data.hInfo(11),'String',constraintStr);
set(data.hInfo(9),'String',constraintValStr);
set(data.hInfo(7),'String',readOnlyStr);
set(data.hInfo(5),'String',roRunningStr);
set(data.hInfo(3),'String',devSpecificStr);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%
%%%%% LTrueFalse %%%%%
%%%%%%%%%%%%%%%%%%%%%%
function str=LTrueFalse(val)
if val,
  str='1 (True)';
else
  str='0 (False)';
end
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%
%%%%% LUpdate %%%%%
%%%%%%%%%%%%%%%%%%%
function data=LUpdate(data,newObj,firstTime)
% Set the value with the old handle
% Insert the new handle and update the selection
if nargin<=2,
  try
    data=LSetValue(data);
  catch
    % Do nothing
  end
  data.CurrentObj=newObj;
end

data=LCreateInfo(data);
data=LCreateObjectString(data);

%A new object is now selected and the listbox needs to be updated as
%well as the property and value fields.
data=LGetCurrentProp(data);

% Update the list
data=LCreateListboxString(data);
data=LPropertyChange(data,1);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%
%%%%% LInitFig %%%%%
%%%%%%%%%%%%%%%%%%%%
function [hFig,data]=LInitFig(obj)

hFig=findobj(allchild(0),'flat','Name','Data Acquisition Property Editor');
if ~isempty(hFig),
  % This will make it visible and bring it to the front.
  figure(hFig)
  data=get(hFig,'UserData');  
  data=LUpdate(data,obj);
  return
end

figWidth=420;  figHeight=480;
[figHoriz,figVert]=LGetFigPos(figHeight,figWidth);
figPos=[figHoriz figVert-30 figWidth figHeight]; % -30 for menu

%%% Other Info

btnColor=get(0,'DefaultUIControlBackgroundColor');

genInfo.Units='pixels';
genInfo.HandleVisibility='off';
genInfo.Interruptible='off';
genInfo.BusyAction='queue';

uiInfo=genInfo;
uiInfo.BackgroundColor=btnColor;
uiInfo.ForeGroundColor=[0 0 0];
uiInfo.Max=1;
uiInfo.Value=1;
uiInfo.HorizontalAlignment='left';

uiTags={
  'PropertyList'
  'Property'
  'ValueEdit';'ValuePopup';'ValueText'
  'Object'
  };
uiCalls={
  'daqpropedit(''PropertyChange'',gcbf)'
  'daqpropedit(''SetProperty'',gcbf);'
  'daqpropedit(''SetValue'',gcbf);'
  'daqpropedit(''SetValue'',gcbf);'
  ''
  'daqpropedit(''ObjectBrowser'',gcbf);'
  };
uiStyle={
  'listbox'
  'edit'
  'edit';'popupmenu';'text'
  'listbox'
  };

uiBgColor={
  'white'
  'white'
  'white';'white';btnColor
  'white'
  };

infoInfo=genInfo;
infoInfo.BackgroundColor=btnColor;
infoInfo.Enable='inactive';

infoStyle={
  'listbox'
  'text';'edit'
  'text';'edit'
  'text';'edit'
  'text';'edit'
  'text';'edit'
  'text';'edit'
  'text';'edit'
  };

infoHoriz={
  'left' ;
  'right'; 'left'
  'right'; 'left'
  'right'; 'left'
  'right'; 'left'
  'right'; 'left'
  'right'; 'left'
  'right'; 'left'
 }; 
infoTags={
  'InfoHelp'
  'InfoDeviceSpecific' ; 'InfoDeviceSpecificVal'
  'InfoReadOnlyRunning'; 'InfoReadOnlyRunningVal'
  'InfoReadOnly'       ; 'InfoReadOnlyVal'
  'InfoConstraintValue'; 'InfoConstraintValueVal'
  'InfoConstraint'     ; 'InfoConstraintVal'
  'InfoDefaultValue'   ; 'InfoDefaultValueVal'
  'InfoType'           ; 'InfoTypeVal'
  };

infoStrings={
  ' '
  'Device Specific:'        ;''
  'Read Only when Running:' ;''
  'Read Only:'              ;''
  'Constraint Value:'       ;''
  'Constraint:'             ;''
  'Default Value:'          ;''
  'Type:'                   ;''
  };



if ~isunix,
  uiBgColor{1}='white';
else
  uiBgColor{1}=btnColor;
end

%%% Create uimenus
menuLabels={
  '&File'
    '>&Close'
  '&Options'
    '>Up&date^d'
  '&Help'
    '>&Property Editor'
    '>&Data Acquisition'
    };
menuCalls={
  ''
    'daqpropedit(''Close'',gcbf)'
  ''
    'daqpropedit(''Update'',gcbf)'
  ''
    'daqpropedit(''Help'',gcbf)'
    'daqpropedit(''HelpDAQ'',gcbf)'
          };
menuTags={
  'MenuFile'
    'MenuFileCloseEditor'
  'MenuOptions'
    'MenuOptionsUpdate'
  'MenuHelp'
    'MenuHelpPropertyEditor'
    'MenuHelpDataAcquisition'
         };

menuLabels = str2mat(menuLabels{:});
menuCalls =str2mat(menuCalls{:});
menuTags=str2mat(menuTags{:});

% set up tool
hFig=figure(                     ...
              'Color'              ,btnColor                      , ...
              'IntegerHandle'      ,'off'                         , ...
              'CloseRequestFcn'    ,'daqpropedit(''Close'',gcbf)' , ...
              'DeleteFcn'          ,'daqpropedit(''Delete'',gcbf)', ...
              'HandleVisibility'   ,'off'                         , ...
              'MenuBar'            ,'none'                        , ...
              'Name'               ,'Data Acquisition Property Editor', ...
              'Tag'                ,'Data Acquisition Property Editor', ...
              'NumberTitle'        ,'off'                         , ...
              'Units'              ,'pixels'                      , ...
              'Position'           ,figPos                        , ...
              'Resize'             ,'on'                          , ...
              'UserData'           ,[]                            , ...
              'Colormap'           ,[]                            , ...
              'Pointer'            ,'arrow'                       , ...
              'Visible'            ,'off'                           ...
              );

hMenu=makemenu(hFig,menuLabels,menuCalls,menuTags);
set(hMenu,'HandleVisibility','off');

for lpF=1:3,
  hFrame(lpF,1)=uicontrol(uiInfo   , ...
                             'Parent'      ,hFig          , ...
                             'Style'       ,'frame'               , ...
                             'Tag'         ,['Frame' num2str(lpF)]  ...
                             );
end

for lpL=1:length(uiTags),
  hUI(lpL,1)=uicontrol(uiInfo          , ...
            'Parent'         ,hFig          , ...
            'Tag'            ,uiTags{lpL}   , ...
            'Callback'       ,uiCalls{lpL}  , ...
            'BackgroundColor',uiBgColor{lpL}, ...
            'Style'          ,uiStyle{lpL}  , ...
            'String'         ,{''}            ...
            );
end % lpL


set(hUI([1 6]),'FontName','FixedWidth','String',' ','Value',1);
set(hUI(1),'Max',2)

for lpI=1:length(infoTags),
  hInfo(lpI,1)=uicontrol(infoInfo        , ...
	    'Parent'             ,hFig            , ...
            'Tag'                ,infoTags{lpI}   , ...
            'Style'              ,infoStyle{lpI}  , ...
            'HorizontalAlignment',infoHoriz{lpI}  , ...
            'String'             ,infoStrings{lpI}  ...
            );
end % lpI
set(hInfo(1), ...
    'BackgroundColor','white'     , ...
    'Max'            ,2           , ...
    'FontName'       ,'FixedWidth', ...
    'Value'          ,[]            ...
    );

data.hInfo=hInfo;
data.hMenu=hMenu;
data.hUI=hUI;
data.hList=data.hUI(6);
data.hValEdit=data.hUI(3);
data.hValPopup=data.hUI(4);
data.hValText=data.hUI(5);
data.hFrame=hFrame;
data.CurrentObj=obj;
data.PropList={''};
data.CurrentProp='';
data.ValidProp=0;
data.WorkspaceVariableName='towork';
data.ToWorkspace=logical(0);
data.ValidValue=logical(1);


data.ObjectList=[];
data.ExpandAll=logical(0);
data.Level=[];
data.IsExpanded=[];
data.HasChildren=[];
data.NameString={};

% Need to get the child order right for tabbing purposes
children=allchild(hFig);
children(16:21)=children([16 21 17 18 19 20]);

set(hFig,'Children',children)

LResize(data,hFig);

data=LCreateInfo(data);
if ~isempty(data.IsExpanded),
  data.IsExpanded(1)=1;
end

data=LGetMapping(data);
data=LCreateObjectString(data);

if ~isempty(data.ObjectList),
  objLoc=[];
  for lp=1:length(data.ObjectList),
    if isequal(data.ObjectList{lp},obj),
      objLoc=lp;
      break;
    end
  end
    
  if isempty(objLoc),
    loc=1;
  else
    loc=find(data.Mapping==objLoc);
    if isempty(loc),
      loc=1;
    end
  end
  set(data.hList,'Value',loc);
  
end
data=LUpdate(data,data.CurrentObj,1);
% This second set is done to clear out the bad set previously done since
% there was nothing seeding the value field.  This will insure that the value
% field is colored black instead of red.
data=LSetValue(data);


set(hFig, ...
    'Visible'  ,'on'                          , ...
    'UserData' ,data                          , ...
    'ResizeFcn','daqpropedit(''Resize'',gcbf)'  ...
    );

data=get(hFig,'UserData');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -