[Lazarus] TCombobox major failure :(

Michael Van Canneyt michael at freepascal.org
Wed Jul 9 15:07:28 CEST 2008


I'm porting some delphi code. In one of my forms I drag from a 
TStringGrid and drop to a TSpinEdit (to "visually" put the value in one 
of the rows of the string-grid in one of multiple spin edits).
The first problem is that TSpinEdit doesn't expose OnDragDrop and 
OnDragOver (I just made a derived component to publish those 
properties), but the real problem is that while I drag the selected row 
in the stringgrid changes. Is there any way to avoid that?

This is what I have in my code:

//The Mouse Down event handler of the TStringGrid
procedure TAjustesSortens.TelegramaFisMouseDown(Sender: TObject;
   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
   if Button=mbLeft then
   begin
      with Sender as TStringGrid do
      begin
        if (Row>0) then BeginDrag(false);
      end
   end;

end;

//Drag over event handler shared by all SpinEdits
procedure TAjustesSortens.sortenDragOver(Sender, Source: TObject; X,
   Y: Integer; State: TDragState; var Accept: Boolean);
begin
   Accept:=(Source=TelegramaFis);
end;

//Drag drop handler shared by all spinedits
procedure TAjustesSortens.sortenDragDrop(Sender, Source: TObject; X,
   Y: Integer);
begin
   With TelegramaFis do
     TMySpinEdit(Sender).Value:=StrToInt(Cells[0,row]);
end;


Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007



More information about the Lazarus mailing list