Delphi Script for Input Parameters in Altium – Undeclared Identifier in SchLib

I’m working on a Delphi script for Altium that creates a pop-up dialog (form) for users to input parameters for resistor components in a schematic library. The script iterates through components and updates their parameters based on user input from TEdit components on the form.

Here’s my problem: the script works fine for the first two iterations of the loop, but on the third iteration, it crashes with what I’m assuming is an Access violation error. The issue seems to be that CurrInput is nil starting from the third iteration. CurrInput.Name and CurrInput.Text are “undeclared identifiers”

I’ve ensured that all TEdit components are properly created and added to the form. I’ve also added debugging messages to verify the initialization of these components. Despite these efforts, the issue persists.

Here’s a snippet of the problematic part of the code:
`
//update parameters when Update button is clicked
procedure TRESinputparamsForm.bUpdateClick(sender : TObject);
begin close;
//create list of params to update as TEdit objects (input boxes from dialog) [CurrInput]
DialogInputsList := TList.Create;
DialogInputsList.Add(PartType);
DialogInputsList.Add(Resistance);
DialogInputsList.Add(Tolerance); //etc…
//create list of param names to index from [CurrDialogParamName]
ParamNameList := TStringList.Create;
ParamNameList.Add(‘PartType’);
ParamNameList.Add(‘Resistance’);
ParamNameList.Add(‘Tolerance’); //etc…

//for every param in DialogInputs list, check if it is in component already
    for I := 0 to (DialogInputsList.Count-1) do
    begin
        CurrInput := DialogInputsList[I];
        CurrDialogParamName := ParamNameList[I];//create parameter iterator for current component
        ParameterIterator := component.SchIterator_Create;
        ParameterIterator.AddFilter_ObjectSet(MkSet(eParameter));
        param := ParameterIterator.FirstSchObject;  
//iterate through parameters of component to find curr param from dialog
        paramFound := false;
        while (param <> nil) and (CurrInput.Text <> '') do
        begin
            paramName := param.Name;
//if param is found in component, update param value from dialog
            if (paramName = CurrDialogParamName) then
            begin
                SchServer.RobotManager.SendMessage(param.I_ObjectAddress, c_BroadCast, SCHM_BeginModify, c_NoEventData);
                param.Text := CurrInput.Text;
                SchServer.RobotManager.SendMessage(param.I_ObjectAddress, c_BroadCast, SCHM_EndModify, c_NoEventData);
                param.ShowName := false;
                param.IsHidden := true;
                paramFound := true;
                break;
            end;       
//check next parameter in component
            param := ParameterIterator.NextSchObject;
        end;      
//if param not found in component, create parameter object then update value from dialog
        if not paramFound then
        begin                    
            newParam := SchServer.SchObjectFactory(eParameter, eCreate_Default);
            newParam.Name := CurrDialogParamName;
            newParam.Text := CurrInput.Text;
            newParam.ShowName := false;
            newParam.IsHidden := true;            
            component.AddSchObject(newParam);
            SchServer.RobotManager.SendMessage(component.I_ObjectAddress, c_BroadCast, SCHM_PrimitiveRegistration, newParam.I_ObjectAddress);
        end;     
        component.SchIterator_Destroy(ParameterIterator);
    end;
    DialogInputsList.Free;
    ParamNameList.Free;
end;`

I created an MVP with just one parameter, and that worked fine both updating a value for components where the parameter already existed, and creating the parameter before adding the value. This works just fine on my small testing SchLib. When I run this larger code built from the MVP, it runs through the first two iterations (parameters PartType and Resistance) but breaks on the third iteration with an error that CurrInput (curr parameter to update, TEdit) is “undeclared identifier” and CurrInput.Text can’t be accessed.

New contributor

cat bag is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật