Jump to content


Check out our Community Blogs

snuppy

Member Since 04 Dec 2008
Offline Last Active Dec 09 2008 10:28 PM
-----

Posts I've Made

In Topic: Treatment of sequences of data

09 December 2008 - 12:06 PM

Please edit:
DELPHI
unit pd1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    ListBox2: TListBox;
    StringGrid1: TStringGrid;
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Button3: TButton;
    Button4: TButton;
    Edit1: TEdit;
    procedure ListBox2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ListBox2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
Caption:=inttostr(key);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
try
ListBox2.items.Add(inttostr(strtoint(Edit1.Text)));
Edit1.Text:='';
except
beep;
showmessage('Nekorekts ievads!');
end;
Edit1.SetFocus;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
ListBox2.Items.Clear;
end;

procedure TForm1.Button1Click(Sender: TObject);
var trigger:boolean;i:integer;
begin
trigger:=false;
if sender=button1 then
 ListBox1.Items.Clear
else
 begin
  StringGrid1.Cells[0,0]:='';
  StringGrid1.RowCount:=1;
 end;
for i:=0 to ListBox2.Items.Count-2 do
if strtoint(ListBox2.Items[i])>strtoint(ListBox2.Items[i+1])
 then
  if not trigger then
   begin
    trigger:=true;
    if sender=button1 then
     ListBox1.Items.add(inttostr(i))
    else
     begin
      if StringGrid1.Cells[0,StringGrid1.RowCount-1]<>'' then
       StringGrid1.RowCount:=StringGrid1.RowCount+1;
     StringGrid1.Cells[0,StringGrid1.RowCount-1]:=inttostr(i);
    end
   end
  else
 else
  trigger:=false;
Edit1.SetFocus;
end;

end.


DELPHI

In Topic: Treatment of sequences of data

07 December 2008 - 08:54 AM

how?

In Topic: Treatment of sequences of data

07 December 2008 - 03:38 AM

What is this:

function Get(s:string): string; 
var i:integer; 
begin 
   for i:=1 to length(s) do 
   begin 
     if i=1 then 
       if s[i]>s[i+1] then result:=result+IntToStr(i-1)+' '; 

     if (i>1)and(i<Length(s)) then 
       if (s[i]>s[i+1])and(s[i]>s[i-1]) then result:=result+IntToStr(i-1)+' '; 

   end; 

end;

...

In Topic: Treatment of sequences of data

05 December 2008 - 06:27 PM

WWWhat? What is a boolean, please exaple :)

In Topic: Treatment of sequences of data

05 December 2008 - 10:24 AM

Now i have this:
procedure TForm1.Button1Click(Sender: TObject);
var S:string;
    j, i, k: integer;
begin
k:=0;
s:= ListBox1.Items[i];
for j:=1 to length(s) do
if s[j] > s[j+1] then
StringGrid1.Cells[0,k]:=S
end;
end.

It's not homework

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download