Why Does OnChange not get Triggered on Combobox when itemindex changes ? lazarus / 21-General ---------------------------------------------------------------------- Weitentaaal · 2021-03-08 09:34 Hello When i do a Change on Itemindex in the Code it wont Trigger the OnChange Event. Thanks ---------------------------------------------------------------------- Zoran · 2021-03-08 11:05 This is documented: https://lazarus- ccr.sourceforge.io/docs/lcl/stdctrls/tcustomcombobox.onchange.html QuoteThis event covers only changes made by the user, not by code. Note that this differs from how other OnChange events work, for example TEdit.OnChange is triggered by code text changes. This event is also triggered when the selection is changed by using the combo box list. and Delphi compatible: http://docwiki.embarcadero.com/Libraries/Sydney /en/Vcl.StdCtrls.TCustomCombo.OnChange QuoteNote: OnChange only occurs in response to user actions. Changing the Text property programmatically does not trigger an OnChange event. ---------------------------------------------------------------------- Weitentaaal · 2021-03-08 12:00 Can u Somehow change this, so it gets triggered also when i change it in Code ? If it doesn't can Some1 Pls Help me write an Event handler wich does this Function ? ---------------------------------------------------------------------- Weitentaaal · 2021-03-08 12:20 is  assigned(onchanged)  True When a Property of the Object Changed  ? And Thank u Guys ---------------------------------------------------------------------- lucamar · 2021-03-08 12:45 Quote from: Weitentaaal on March 08, 2021, 01:20:09 pmis  assigned(onchanged)  True When a Property of the Object Changed  ? Assigned(MyComboBox.OnChange) will be True when you have got an event handler for the box's OnChange event. When you do a change by code you can do something like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MyComboBox.ItemIndex := 0;if Assigned(MyComboBox.OnChange) then  MyComboBox.OnChange(MyComboBox); That ensures that there is a handler assigned to OnChange; otherwise you run the risk, if it isn't, that the call ends up in la-la-land, which would produce a segmentation fault. Of course, if you're absolutely sure that the handler is there (and assigned, e.g. because you set it at design-time) you can omit the test, though I don't recommend it: one never knows what might happen in the future and this ensures that no matter what your code will always work and not jump around picking berries