add parameter OnMouseMove method

Please discuss general Delphi programming topics here.

add parameter OnMouseMove method

Postby x_sanctus » March 15th, 2005, 5:19 am

i have problem with button in my linked list
Code: Select all
//tipe list of simpul
   PSimpulNode   =^TSimpulNode;
   Simpul   = record
      ns   :integer; //nomor simpul
    Button:TBitBtn;
   end;
   TSimpulNode   =record
      Next   : PSimpulNode;
      Info   : Simpul;
   end;
  ListSimpul=record
      First   : PSimpulNode;
    lastno:integer;
  end;
//tipe list of sisi
   PSisiNode=^TSisiNode;
   Sisi   = record
      aw   : integer;
      ak   : integer;
      s   : integer;
      v   : integer;
      d   : real;
    state:integer;
    Org:TPoint;
    Des:TPoint;
   end;
   TSisiNode   =record
      Next   : PSisiNode;
      Info   : Sisi;
   end;
  ListSisi=record
      First   : PSisiNode;
  end;



i have 2 global variabel
L:ListSimpul;
S:ListSisi;
Code: Select all
i create  the button just like this
procedure TmainForm.BitBtn1Click(Sender: TObject);
var
  newbtn:TControl;
  newsimpul:PSimpulnode;
begin
  isnewrouter:=1;
  if(isnewrouter=1) then //create simpul
  begin
     newbtn:= TBitBtn.Create(btnowner);
     newbtn.Width:=50;
     newbtn.Height:=52;
     (newbtn as TBitBtn).Glyph.LoadFromFile('mycomp.bmp');
     if ((nbsimpul > 5)and (nbsimpul mod 5 =1)) then  begin
       inc(j,70); i:=50;
     end else begin
       if(nbsimpul=0) then i:=70 else inc(i,70);
     end;
     newbtn.Visible:= true;
     newbtn.Parent:= Scrollbox1;
     paintbox1.Width := scrollbox1.Width;
     paintbox1.Height := scrollbox1.Height;
     getmem(newsimpul,sizeof(TSimpulNode));
     AllocNodeSimpul(newSimpul,L.lastno+1,(newbtn as TBitBtn));
       newbtn.Left:=i;
       newbtn.Top:=j;
       newbtn.Width:=50;
     newbtn.Height:=52;
     newbtn.Parent:= Scrollbox1;
     newsimpul^.Info.Button.OnClick:= newbtnonclick;
     newsimpul^.Info.Button.OnMouseDown:= newbtnMouseDown;
     newsimpul^.Info.Button.OnMouseMove:= [b]newbtnMouseMove[/b];
     newsimpul^.Info.Button.OnMouseUp:= newbtnMouseUp;
     insertSimpul(L,newsimpul); nbsimpul:=nbsimpul+1;
     isnewrouter:=0;
  end;
end;


this is the declaration of newbtnMouseMove method
procedure newbtnMouseMove(Sender: TObject; Shift: TShiftState; X, Y:Integer);

when this method called i need the newsimpul^.Info.ns how can i add the parameter? or is there any way that i can get newsimpul^.Info.ns without make it as parameter.
i add my code because i think i dont explain it well so i attached my code
(in mycode.rar)

please hellp........... i really get stuck with this program :(
x_sanctus
Active Member
Active Member
 
Posts: 5
Joined: March 2nd, 2005, 1:22 pm

Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron