Dear All
codeSoft 5版本
如主題,以下先放圖片再陸續說名:
![](http://delphi.ktop.com.tw/loadfile.php?TOPICID=16279769&CC=364091)
(圖一)
![](http://delphi.ktop.com.tw/loadfile.php?TOPICID=16280082&CC=364098)
(圖二)
以下是程式碼:
//=================================== unit unit_codesoft_5; interface
uses classes,sysutils,LabelManager_TLB,OleServer; type
TCodeSoft_5= class(TCS_5)
private public
m_CS5Document : Document;
m_CS5Variables : Variables;
m_CS5Variable : Variable;
m_bSetPath : boolean;
procedure setLabelFile(sPath:string;bReadonly:boolean);
function setVariablePosition(iIndex : integer): boolean;
end; implementation procedure Tcodesoft_5.setLabelFile(sPath:string;bReadonly:boolean);
begin
Document.QueryInterface(DIID_Document,m_CS5Document);
if m_bSetPath then m_CS5Document.Close(false);
m_CS5Document.Open(sPath,bReadonly);
m_CS5Document.Variables.QueryInterface(DIID_Variables,m_CS5Variables)
m_bSetPath:=true; end; function Tcodesoft_5.setVariablePosition(iIndex : integer):boolean;
begin
result := false;
if iIndex > m_CS5Variables.Count then exit; m_CS5Variables.Item[iIndex].QueryInterface(DIID_Variable,m_CS5Variable);
result:=true;
end;
//===========================
function Tform_code_soft.getLabelValue(var tsParameterName:tstrings;var tsParameterValue:tstrings;var sMessage : string) : boolean;
var i : integer;
begin
result:=false; tsParameterName.Clear;
tsParameterValue.clear; if not checkCorrectLabel(sMessage) then exit; case m_iCodesoftVer of
5: for i:=1 to cs_5.m_CS5Variables.Count do begin
cs_5.setVariablePosition(i);
tsParameterName.Add(cs_5.m_CS5Variable.Name);
tsParameterValue.add(cs_5.m_CS5Variable.Value);
end;
end; sMessage := 'Get Label Value OK !!';
result:=true;
//==========一個button 名為'bttnGetLabelValue'==================
procedure TForm1.bttnGetLabelValueClick(Sender: TObject);
var
tsParameterName,tsParameterValue : TStrings;
i : Integer;
sMessage : string;
begin
tsParameterName:=TStringList.create;
tsParameterValue:=TStringList.create;
try
if not form_code_soft.getLabelValue(tsParameterName,tsParameterValue,sMessage) then begin
showmessage(sMessage);
exit;
end;
listbParameterName.clear;
listbParameterValue.clear;
for i:= 1 to tsParameterName.count do begin
listbParameterName.items.add(tsParameterName[i-1]);
listbParameterValue.items.add(tsParameterValue[i-1]);
end;
finally
tsParameterName.free;
tsParameterValue.free;
end;
end;
//===================================
只是應該如何懹
圖二知排序如同
圖一 感激不盡 doll_candy