Jump to content

What does this short code do?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
18 replies to this topic

#1
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
Could someone explain me what does this code do?

unit XX;

interface


uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, Main;


type

  TComponentList = class(TForm)

    ListBox1: TListBox;

    procedure ListBox1Click(Sender: TObject);

  private


  public


  end;


var

  ComponentList: TComponentList;


implementation


{$R *.DFM}


procedure TComponentList.ListBox1Click(Sender: TObject);

var

   i:Integer;

   MyName:string;

   MyObject:TObject;

begin

ListOfSelectedObjects.UnSelect; 


MyName:='';

for i:=0 to ListBox1.Items.Count-1 do

   if ListBox1.Selected[i] then MyName:=ListBox1.Items[i];

if MyName='' then ShowMessage('Greska : Ime nije pronadjeno);

MyObject:=GetObjectByName(MyName);

MyObject.Select;

MyObject.Draw;


end;


end.interface


uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, Main;


type

  TComponentList = class(TForm)

    ListBox1: TListBox;

    procedure ListBox1Click(Sender: TObject);

  private


  public


  end;


var

  ComponentList: TComponentList;


implementation


{$R *.DFM}


procedure TComponentList.ListBox1Click(Sender: TObject);

var

   i:Integer;

   MyName:string;

   MyObject:TObject;

begin

ListOfSelectedObjects.UnSelect; 


MyName:='';

for i:=0 to ListBox1.Items.Count-1 do

   if ListBox1.Selected[i] then MyName:=ListBox1.Items[i];

if MyName='' then ShowMessage('Greska : Ime nije pronadjeno);

MyObject:=GetObjectByName(MyName);

MyObject.Select;

MyObject.Draw;


end;


end.



#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It's almost impossible to tell without have the .dfm code as well. It appears to go through a list of names that correspond to objects in a list and show the one that was clicked on.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
Ok, thanks.And, how about this one:

interface


uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, ExtCtrls, Main;


type

  TDlgConf = class(TForm)

    CheckBox2: TCheckBox;

    RadioGroup1: TRadioGroup;

    CheckBox3: TCheckBox;

    Button1: TButton;

    procedure CheckBox2Click(Sender: TObject);

    procedure RadioGroup1Click(Sender: TObject);

    procedure CheckBox3Click(Sender: TObject);

  private


  public


  end;


implementation


{$R *.DFM}


procedure TDlgConf.CheckBox2Click(Sender: TObject);

begin

SelectLineWithNodes:=CheckBox2.Checked;

end;


procedure TDlgConf.RadioGroup1Click(Sender: TObject);

begin

LineWithComponent:=RadioGroup1.ItemIndex;

if LineWithComponent=1 then

   begin

   CheckBox2.Checked:=True;

   SelectLineWithNodes:=CheckBox2.Checked;

   end;

end;


procedure TDlgConf.CheckBox3Click(Sender: TObject);

begin

AutoConnect:=CheckBox3.Checked;

end;


end.



#4
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Why are you asking us to identify random code for you? Learn the language and then you won't have to ask other people to do your work for you.

#5
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
This is help and support, and I don't have intention to explain why I need it.
If you don't know, you aren't in obligation to reply.

#6
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
I never said I was obligated to reply.

I am simply saying that posting code asking people to tell you what it does makes you look like a skiddy.

How is that for an explanation?

#7
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
I don't care?
I need help with it, in a short period, think I care for reputation?

#8
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Did I ask if you cared? I am just simply saying that is how you look.

And from what you have said so far it looks like you are some skiddy or just some college kid that was too lazy to do their computer science homework on time.

So now you are falling back on some coders at a forum to bail you out.

#9
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
I'm in high school, and that really is the situation :)

#10
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Okay, well now that you aren't hiding that anymore, lol.

#11
Java_Chick

Java_Chick

    Newbie

  • Members
  • PipPip
  • 14 posts
Hm, I can't remember what I put in my profile as an age information, but in every case, yep, I'm a lazy high school "skiddy" :P

#12
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Well do you plan on pursuing programming as a career?

If so you are a lot better off learning the language now and not being lazy about it, because you'll be much better off later on.