Recent

Author Topic: About case block  (Read 3521 times)

ariben

  • New Member
  • *
  • Posts: 38
Re: About case block
« Reply #15 on: November 17, 2023, 03:40:15 pm »
Thanks for a code.
I carbon copied the code. But I came across 'ACCESS VIOLATION'.
I need to rework.

Zvoni

  • Hero Member
  • *****
  • Posts: 2914
Re: About case block
« Reply #16 on: November 18, 2023, 02:29:33 pm »
Thanks for a code.
I carbon copied the code. But I came across 'ACCESS VIOLATION'.
I need to rework.

Code: Pascal  [Select][+][-]
  1.     //Somewhere above
  2.     Const
  3.        Oprt1:Array[0..2] Of String=('AND','OR','AND NOT');
  4.      
  5.     procedure TForm1.RadioGroup1Click(Sender: TObject);
  6.     begin    
  7.        If RadioGroup1.ItemIndex>-1 Then
  8.            Edit1.Text := Oprt1[RadioGroup1.ItemIndex]; // added
  9.     end;
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

ariben

  • New Member
  • *
  • Posts: 38
Re: About case block
« Reply #17 on: November 18, 2023, 10:46:38 pm »
Thanks for a code.
I carbon copied the code. But I came across 'ACCESS VIOLATION'.
I need to rework.

Code: Pascal  [Select][+][-]
  1.     //Somewhere above
  2.     Const
  3.        Oprt1:Array[0..2] Of String=('AND','OR','AND NOT');
  4.      
  5.     procedure TForm1.RadioGroup1Click(Sender: TObject);
  6.     begin    
  7.        If RadioGroup1.ItemIndex>-1 Then
  8.            Edit1.Text := Oprt1[RadioGroup1.ItemIndex]; // added
  9.     end;

Thank you very much for a code. This works fine if I search a single word.
But access violation takes places as I select the operator.

cdbc

  • Hero Member
  • *****
  • Posts: 1964
    • http://www.cdbc.dk
Re: About case block
« Reply #18 on: November 19, 2023, 09:20:00 am »
Hi
Have you by any chance, more radiobuttons than slots in your array?!?
The count of both must match.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

ariben

  • New Member
  • *
  • Posts: 38
Re: About case block
« Reply #19 on: November 19, 2023, 02:35:13 pm »
Hi
Have you by any chance, more radiobuttons than slots in your array?!?
The count of both must match.
Regards Benny

Thank you very much for your advice. It's time to go to the bed.
I'll try this tomorrow.

ariben

  • New Member
  • *
  • Posts: 38
Re: About case block
« Reply #20 on: November 20, 2023, 10:06:05 pm »
Thanks, Now I'm having heavy flu, too sick to try your advice.

ariben

  • New Member
  • *
  • Posts: 38
Re: About case block
« Reply #21 on: November 22, 2023, 09:46:44 pm »
Hi
Have you by any chance, more radiobuttons than slots in your array?!?
The count of both must match.
Regards Benny

Thank you. But nothing changed.

 

TinyPortal © 2005-2018