[SOLVED] Object inspector range limit lazarus / 31-LCL ---------------------------------------------------------------------- pcurtis · 2021-11-09 03:34 I have an integer property and I want to limit the range I can enter in the object inspector to say between 500 to 1000. How do I do that? 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 procedure TMyThing.SetTime(aValue: Integer);begin  if aValue > 1000 then aValue := 1000;  if aValue < 500 then aValue := 500;  if fTime <> aValue then  begin    fTime := aValue;  end;end; Only half works. I can still enter an out of range value. ---------------------------------------------------------------------- nouzi · 2021-11-09 08:43 You can use 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 var   a : 500..1000  ;       ... 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 ShowMessage('max A : ' + inttostr(High(a)) + #10#13 + 'min A : ' + inttostr(Low(a)));   // Write('max A :' , High(a));  // write ('min A :' , Low(A)) ---------------------------------------------------------------------- pcurtis · 2021-11-09 09:36 How does that help? ---------------------------------------------------------------------- wp · 2021-11-09 09:47 Quote from: pcurtis on November 09, 2021, 04:34:55 amCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TMyThing.SetTime(aValue: Integer);begin  if aValue > 1000 then aValue := 1000;  if aValue < 500 then aValue := 500;  if fTime <> aValue then  begin    fTime := aValue;  end;end;This looks correct, and I cannot imagine how somebody could enter an out-of-range value here. I guess the bug is somewhere else. ---------------------------------------------------------------------- Zvoni · 2021-11-09 09:50 What's bugging me is the OP's usage of "Object Inspector" for a custom class EDIT: Or does it have to do with this: https://forum.lazarus.freepascal.org/index.php/topic,57078.0.html ---------------------------------------------------------------------- howardpc · 2021-11-09 10:39 Quote from: pcurtis on November 09, 2021, 10:36:04 amHow does that help? Perhaps nouzi was suggesting use of a subrange type (rather than Integer) for the property. However, I agree with wp. Your property setter ensures that out-of- range values cannot be entered (whether via the Object inspector or in code). So if your component does not behave as expected in the Object Inspector perhaps it is not installed correctly, or maybe you have an older version of it installed. ---------------------------------------------------------------------- pcurtis · 2021-11-09 11:17 The problem is for example if my lower limit is 500, and I enter 100, 500 is passed to the property but 100 is displayed in the object inspector. ---------------------------------------------------------------------- wp · 2021-11-09 11:39 Did you recompile the IDE after you introduced this ranged input? If you did, and if you don't find any other related bugs, you may need a special property editor for this. Study unit propedits.pp in components/ideintf. ---------------------------------------------------------------------- pcurtis · 2021-11-09 12:28 @wp Again thanks after clean up and rebuild all ok.